Select Control with Jquery
Today we are going to discuss about the usage of jquery on select option control .Select control is most often used due to its functionalities.On the other hand Jquery is the most popular and fastest client side library.So here we go, HTML <select class="form-control" id="test"> <option value='1'>Hello</option> <option value='2'> How are you</option> </select> Case 1 How can we get the selected value using jquery? $(document).ready(function () { var t1= $('#test').val(); alert(t1); }); This will display the selected value of the select control with the Id 'test'. Case 2 How can we get the selected text using jquery? $(document).ready(function () { var t1= $('#test option:selected').text(); alert(t1); }); This will display the selected text like 'hello' or 'how are you'(as per our example) of the select control with the id ...