jQuery get selected option text
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html> <head> <title>Dropdown text - jQuery Example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $("#demo").change(function () { var myVal =$("#demo :selected").text(); alert(myVal); }); }); </script> </head> <body> <select id="demo"> <option value="0">first</option> <option value="1">second</option> <option value="2">third</option> </select> </body> </html>
<!DOCTYPE html> <html> <head> <title>Dropdown text - jQuery Example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $("#demo").change(function () { var myVal =$("#demo :selected").text(); alert(myVal); }); }); </script> </head> <body> <select id="demo"> <option value="0">first</option> <option value="1">second</option> <option value="2">third</option> </select> </body> </html>
Copyrights@tutorialsplane.com