I have a repeating table row with a select list. I want to create an array from the number of select textfields a user has generated. I am using .each function to iterate through all the select textfields. Here is the code I am using. The id of the dynamically created list is “countrylist”
$("#Submitcountry").click(function(){
$("#countrylist").each(function() {
var countrylist= [$("#countrylist").val()];
//var countrylist = [1,2,3,4,5]
alert(countrylist);
});});
As from the above, I want to see the values that I have selected. The only problem is that the alert only shows the first row. All help appreciated
countrylist -> .countrylist
id should be one in a html page.
So, you have to change id countrylist into class countrylist, I think.