Thursday, February 17, 2011

Event Binding & attribute setting example in Jquery

    $("#txtZipCode").unbind();   //Unbind all existing events on text box called txtZipCode

    $('#txtZipCode').bind('keypress', function () { $('#txtZipCode').alphanumeric(); });   //Binds alphanumeric      plugin to the KeyPress event of the text box.

    $('#txtZipCode').attr("maxLength", "5");   //Sets the maxLength attribute to 5

No comments: