javascript - Get on top of the select option a specific value -


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> 

now, have $kategoria php value holds selected value. i'd need javascript in order i.e , if $kategoria=id in form

<option value="id">id</option>  

should come first.. please!

<script type="text/javascript">     $("select option").filter(function() {         return $(this).attr("value") == "<?php echo $kategoria; ?>";      }).prop('selected', true); </script> 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -