javascript - Keep selected data after form submit -
i have form here:
<form action="listasearch.php" method="get"> <select name="kategoria"> <option value="klienti">klienti</option> <option value="id">id</option> <option value="dyqani_pergjegjes">dyqani përgjegjës</option> <option value="emri">emri</option> </select> </form> the issue is, need keep selected value, if had 2 similar names, i.e dyqani_pergjegjes , dyqani_pergjegjes, it's dyqani pergjegjes then.
someone please me this? thanks
var select=document.getelementsbyname("kategoria"); for(var i=0;i<select[0].options.length;i++){ if(select[0].options[i].text=="dyqani përgjegjës") // if(select[0].options[i].value=="dyqani_pergjegjes") //or select[0].selectedindex=i; }
Comments
Post a Comment