Hello Freinds,
if you want to get selected value or html content of dropdown or select using jquery then you can use on change event and also you can get all the attribute of selected option.
Live Demo
if you want to get selected value or html content of dropdown or select using jquery then you can use on change event and also you can get all the attribute of selected option.
<html>
<head>
<script src="http://code.jquery.com/jquery-1.7.2.js "></script>
</head>
<body>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#select_id').change(function(){
//get content from dropdown option tag
alert(jQuery(this).find("option:selected").text());
alert(jQuery(this).find("option:selected").val());
});
});
</script>
<select id="select_id" /><option value="1">option 1</option>
<option value="1">option 2</option>
<option value="1">option 3</option>
</select>
</body>
</html>
<head>
<script src="http://code.jquery.com/jquery-1.7.2.js "></script>
</head>
<body>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#select_id').change(function(){
//get content from dropdown option tag
alert(jQuery(this).find("option:selected").text());
alert(jQuery(this).find("option:selected").val());
});
});
</script>
<select id="select_id" /><option value="1">option 1</option>
<option value="1">option 2</option>
<option value="1">option 3</option>
</select>
</body>
</html>
Live Demo