Showing posts with label event. Show all posts
Showing posts with label event. Show all posts

Sunday, February 23, 2014

jQuery Change Event: Proper Binding


$("input[name='name']").on("input", function(event) {
    $("div").prepend("Text: " + $(this).val() + "<br/>");
});

// or

<input type='text' name='name' oninput='$(this).changeOccurs()'/>

and in jquery:
jQuery.fn.changeOccurs = function () {
    // do something you wish to do.
};

jsFiddle link

Thursday, August 8, 2013

jQuery check a checkbox without firing a change event

You should suspend events before set the value and resume events after this. For example:
myCheckBox.suspendEvents(false); // Stop all events. 
//Be careful with it. Dont forget resume events!
myCheckBox.setValue(!myCheckBox.getValue()); // invert value
myCheckBox.resumeEvents(); // resume events