How to get the option value using the text inside the dropdown?
I would like to get the option value using the text value inside the dropdown.
If you look at the code below, I want to retrieve the value "javaAndJ2ee" into var Opt. Not working though.
<script>
$(document).ready(function(){
var Opt = $('#modifyType option[text="JAVA AND J2EE"]').val();
//Do Processing
});
</script>
<body>
<select id="modifyType">
<option value="java">JAVA</option>
<option value="javaAndJ2ee">JAVA AND J2EE</option>
</select>
</body>
Can you please provide some input on this.