jQuery > Events

Change event in jQuery

How to attach change event to a html element in jQuery?

To attach change event to an element, change() method can be used that fires when the element value is changes.

       $("#dropChange").change(function () {
           alert("change handler called");

Above code snippet find the dropdown whose id is "dropChange" and attach change event. When this drop down value changes, the defined function fires that shows "change handler called" message in the JavaScript alert box.

 Views: 1546 | Post Order: 61

Write for us