Additional Info: jQuery 1.10.2 using the syntax $('select').on('change', function(){ /* do seomthing */ }); if somebody also need to get the text of the option, here is it $(this).find('option:selected').text(); The open-source game engine youve been waiting for: Godot (Ep. How to get the children of the $(this) selector? In the JQuery code above, we changed our select element option to "Ireland" using the attr method. How do I get the current date in JavaScript? Eventhough is the best, it doesnt suit the original question nor does it say that the user needs to install something else for it to work. javascript code for dropdown selection. How can the mass of an unstable composite particle become complex? I'm really kind of baffled reading these comments. Loop (for each) over an array in JavaScript. To fix use, Or you can use simple Javascript like this-, jQuery get value of select html elements using on Change event. Depending on the type of element being changed and how the user interacts with the element, the change event is fired at different times. $ ('.select2-selecting').on ('focusin', function () { console.log ("Saving value " + $ (this).val ()); $ (this).data ('val', $ (this).val ()); }); And then get the saved old value in your onchange function: How can I get the ID of an element using jQuery? There are several ways to achieve your desired result, this my humble way of doing it: Let the element hold its previous value, so add an attribute 'previousValue'. Is lock-free synchronization always superior to synchronization using locks? in not doing so when you try to pull back the values you end up pulling in the new copy of the select rather than the previous. When a change happens, Angular uses event binding to listen for it and then executes the component's onChange () method. 1. Does Cosmic Background radiation transmit heat? is a dependency here, but this can be adapted to work in pure javascript. Yep - make the value of the option the same as what it is. By using this site, you agree to the use of cookies, our policies, copyright terms and other conditions. For my case, code is working on Firefox but not on Chrome. How to pass parameters on onChange of html select, The open-source game engine youve been waiting for: Godot (Ep. I was able to implement easily without libraries. This will give you whatever value is on the select dropdown per click. My code is htmlData.push('