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

Weekend Escape to Berjaya Hills, Colmar Tropicale Resort - Day 2

Berjaya Hills (Colmar Tropicale) ေနအထြက္ကုိ ျပတင္းေပါက္ကေနေစာင့္ မနက္ ေစာေစာထ၊ ေရခ်ိဳးျပီးတာနဲ႕ ျပတင္းေပါက္ဖြင့္ျပီး ေနထြက္တာကုိ ေစာင္...