Hi all,
My page has a SELECT(drop-down list) element and i have to add options dynamically to it.Before adding i have to know whether that option is already there in the drop-down list.
i tried this....
if(myDropDown.o ptions[2].text == "NewYork") {
............
this checks the 3rd option of the drop-down list, but i want to check all the option items.
i can go thru' every option using a for loop like this....
for(i=0;i<optio ns.length;i++)
{
if(myDropDown.o ptions[2].text == "NewYork") {
...........
}
Is this the only way to check whether the option is already there or not?
Is there anything i can try like this....
myDropDown.opti ons.text == "NewYork"
Sorry for elaboration.... Thanks for any replies
-Satya
My page has a SELECT(drop-down list) element and i have to add options dynamically to it.Before adding i have to know whether that option is already there in the drop-down list.
i tried this....
if(myDropDown.o ptions[2].text == "NewYork") {
............
this checks the 3rd option of the drop-down list, but i want to check all the option items.
i can go thru' every option using a for loop like this....
for(i=0;i<optio ns.length;i++)
{
if(myDropDown.o ptions[2].text == "NewYork") {
...........
}
Is this the only way to check whether the option is already there or not?
Is there anything i can try like this....
myDropDown.opti ons.text == "NewYork"
Sorry for elaboration.... Thanks for any replies
-Satya
Comment