Hello Reader's if your building the html 5 based web form and want to set the value of select box via Jquery then you can learn it from code as below:-
First you need to set the value from html page
<input type = "text" id = "txtEmail" value = "option1">
<select id= "myoption">
<option value="option1"> option1</option>
<option value="option2"> option2</option>
<option value="option3"> option3</option>
<option value="option4"> option4</option>
<select>
Now make the script the get the values
<script>
val = $("#txtEmail").val();
$("#myoption").val(val);
</script>
Now everytime script will load it will take value from element having id txtEmail and put into element which have id myoption
0 Comment(s)