I\'m having a hard time with getting the value of my dynamically appended textboxes. I\'m using the $.each
function to iterate all of the textboxes according to
In general its better to use a class for it, because ids are a unique identifier, you should not work with arrays in them. if you want to handle them server side after a post you better do it this way :
and for your script
$('#save_grade_button').click(function (){
$('.studentGrade').each(function() {
var grade = $(this).val();
alert(grade);
});
});
Edit: since jQuery 1.7, you should bind your event with .on()
$('#save_grade_button').on('click', function (){
$('.studentGrade').each(function() {
var grade = $(this).val();
alert(grade);
});
};
OR if the save button will be dynamically too
$(document).on('click', '#save_grade_button', 'gradeSaveClick' function (){
$('.studentGrade').each(function() {
var grade = $(this).val();
alert(grade);
});
};