I have an HTML control:
<select id="grade">
I want to get the selected value of dropdown on selected Index changed event.
I tried to add following code which would be called on drop down selection change, but seems it doesnot work. Any other suggestion ?
$("#grade").on('change', function() {
alert("hi");
});
Also, how can I get the selected value in Java Script.
If ID=grade doesn’t exist when code is run, you need to delegate the handler to a permanent asset in the page. This can be any element selector up the tree from your eleemnt or body or document itself. This method will work regardless if selector already exists, or will exist in future
If the ID does exist, your code should work so long as you have wrapped it in
*document.ready*