The task is this: you need to get all the text fields from the form element and change the value the specific element, say the third.
$('.reg:text'); // получи доступ ко всем элементам text из класса reg The task is this: you need to get all the text fields from the form element and change the value the specific element, say the third.
$('.reg:text'); // получи доступ ко всем элементам text из класса reg Brute force:
$('yourForm').children('input:text').each(function (index) { //перебор всех элементов if (index == 2) { //третий элемент, так как у первого index==0 //исполняем, например: $(this).val('newVal'); //назначили новый value третьему элементу } }); Instant access:
$('yourForm').children('input:text').eq(2).val('newVal'); //исполняем. Назначили новый value третьему элементу. Source: https://ru.stackoverflow.com/questions/36648/
All Articles