How to get all id's of input elements inside a form in an array?
Something along the lines...
<script src="../../Scripts/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function ()
{
// Get all the inputs into an array...
var $inputs = $('#myForm :input');
// An array of just the ids...
var ids = {};
$inputs.each(function (index)
{
// For debugging purposes...
alert(index + ': ' + $(this).attr('id'));
ids[$(this).attr('name')] = $(this).attr('id');
});
});
</script>
$ids = $('#myform input[id]').map(function() {
return this.id;
}).get();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With