Wednesday, April 1, 2009

[jQuery] Changing Method Values on the Fly

I want to dynamically change the function value of the submitHandler:
method. How can I do this?


Here is some sample code:

----------------
$('#update_inventory').validate({
submitHandler: function(form) {
$(form).ajaxSubmit({
target: '#inventory',
success: parseResponse
});
},
debug: true,
errorElement: "em",
errorContainer: $("#warning, #summary"),
errorPlacement: function(error, element) {
error.appendTo( element.parent("span").next("span") );
},
success: function(label) {
label.text("ok!").addClass("success");
}

});

No comments: