Как получить весь идентификатор входных элементов в форме в массиве?
Что-то вроде ...
<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>
Вы можете сузить поиск с помощью более точного селектора : вход формы и селектора атрибутов для тех, у которых есть id
$(document).ready(function() {
$('form input[id]').each(function() {
formId.push(J(this).attr('id'));
});
});
$ids = $('#myform input[id]').map(function() {
return this.id;
}).get();