Using jQuery to set the selected element of the select control to be the item with the text description. Value from php.
1 2 3 4 5 6 7 8 | //set js var from php var var myText = '<?php echo $myText; ?>' ; //set selected using text value //$("#my-Select option[ text=" + myText + "]").attr("selected","selected") ; //set selected using value value $( "#my-Select option[value=" + myText + "]" ).attr( "selected" , "selected" ) ; |
What do you think?