Professional Documents
Culture Documents
Today I am going to tell you how to get the dropdown value when the user clicks on it. It
sometimes very much useful to get the value and stored it on database.
For example you may use the time zone or anything.At that time it provides more helpful
to you.
<body>
<select name="getdropdown" id="getdropdown">
<option value="1">Trial 1</option>
<option value="2">Trial 2</option>
<option value="2">Trial 3</option>
<option value="2">Trial 4</option>
<option value="2">Trial 5</option>
<option value="2">Trial 6</option>
</select>
</body>
</html>
$(document).ready(function(){
$("#getdropdown").change(function() {
var trial=$("#getdropdown option:selected").text();
alert(trial);
});
});
You can put val() instead of text() you get the dropdown value