In my web application a method returns a list of array contains ID’s of select options which should have to be selected. Its is hard to make them all selected using DOM methods.
Is there any way to do it using jQuery.
Any suggestions would be more appreciative…
Thanks in Advance!!!
EDIT: Based on your comment below, your data looks the code below.
There’s a problem. It is not valid for an HTML ID attribute to start with a number. IDs must begin with a letter.
I’ll show you the solution anyway, but you should fix the IDs.
Now this will give you the value of
respIDin each iteration of the loop.But again, HTML IDs can not start with a number. I’d suggest updating your HTML ID attributes to something like
id_5instead of5.Then you would do this: