JQuery if statements?
- by SLAPme
New to JQuery and was wondering how can I put the following JQuery code in an if statement so that it only runs when the submit button is clicked and does nothing when not clicked I know I'm using the $(".save-button").click(function() is there a way to put it in an if statement?
JQuery code.
$(function() {
$(".save-button").click(function() {
$.post($("#contact-form").attr("action"), $("#contact-form").serialize(), function(html) {
$("div.contact-info-form").html(html);
$('#changes-saved').append('<li>Changes saved!</li>').show().pause(1000).hide();
});
return false; // prevent normal submit
});
});