javascript - dynamic dropdown list with jquery and sqlite show incorrectly -


i try use sqlite create dynamic dropdown list. sql tabels country, country_district , district. country tabel have c1 , c2. district table have d1,d2,d3,d4. country_district gave pair (c1,d1),(c1,d2),(c1,d3) , (c2,d4). select c1 in country dropdown , d1 in district dropdown. after change selection in country c2. district dropdown still show d1 wan empty string. thank

$(document).ready(function () {     $("#country").change(function () {         country = $(this).val();         $('#district option:eq(0)').attr('selected','selected');         db.transaction(changecountry, errorcb, sucesscb);     }); });  function changecountry(tx) {     tx.executesql('select d.* country_district cd , district d cd.country=? , cd.district = d.district', [country], renderdistrictlist, errorcb);  } function renderdistrictlist(tx, results) {     var len = results.rows.length;     var htmlstring = "<option value=\"\" > </option>";       (var = 0; < len; i++) {          htmlstring += "<option value=\"" + results.rows.item(i).district + "\">" + results.rows.item(i).district + "</option>";      }     $('#district').empty().append(htmlstring); } 


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -