Javascript : Get dropdownlist value by text

Javascript
=========
var i ;
var searchtext = "Yangon";
var citycode;
var ddl = document.getElementById("ddlCity");
for (i = 0; i < ddl.options.length; i++) {
if (ddl.options[i].text == searchtext ) {
              citycode = ddl.options[j].value;
}
}

No comments:

Post a Comment

ဆန္းဆန္းတင့္ (၁) ၊ ၾကြက္ကေလးနဲ႕ ကုိယ္

ကုိယ္ဟာ ဆန္းဆန္းတင့္သူတစ္ေယာက္ပါ။ အဲဒိအေၾကာင္းနဲ႕ ပတ္သတ္လုိ႕ အရင္ကေတာ့ ေပါ့ေပါ့ဆဆပါပဲ။ တျဖည္းျဖည္း ေပ်ာ္ရႊင္မွဳေတြ နည္းနည္းလာတာက...