I have generated multiple text boxes using PHP with name="student[<?php echo $StudentID ; ?>]"
.
Now on a button click i want to change the value of all these text boxes using jquery.
How do i do this ? Please help.
You can use the Attribute Starts With selector, to look for student[
at the beginning of the name attribute:
$('input[name^="student["]').val('the new value');
It's probably unnecessary to include the [
at the end, and name^="student"
will be sufficient, assuming you don't have other inputs with names like student_name
or the like.
// If no conflicting named inputs, use
$('input[name^="student"]').val('the new value');