jquery option selected value
<select id="myselect">
<option value="1">Mr</option>
<option value="2" selected="selected">Mrs</option>
<option value="3">Ms</option>
<option value="4">Dr</option>
<option value="5">Prof</option>
</select>
<script>
alert($( "#myselect" ).val()); //alert '2'
//OR
alert($( "#myselect option:selected" ).attr('value')); //alert '2'
//Use this if you want to get the label and not the value
alert($( "#myselect option:selected" ).text()); //alert 'Mrs'
</script>$('#dropDownId').val();$("#id option:selected").text();var selectedOptionText = $('#mySelectID').find(":selected").text();//selected option text
var selectedOptionVal = $('#mySelectID').find(":selected").val();//selected option value
Also in HTML:
- html ecrire en gras
- html play video on hover
- more than one class in div
- html how to type a long string in many lines
- how to resize submit button in html
- Uncaught TypeError: Failed to execute 'insertAdjacentElement' on 'Element': parameter 2 is not of type 'Element'
- html nav
- TYPESCRIPT RETURN HTML ELEMENT
- wordpress get link
- html timer
- iframe youtube playlist not working html
- javascript onclick alert are you sure
- how to put one div over another
- tabs to other pages html
- xbox roblox games
- vm player linux
- how to show a javascript variable in html
- add mute button to html5 video player
- vue conditional class
- color de las letras en html
- html inline javascript
- html select multiple
- hr tag in html
- add manifist to html