I'm trying to make a message pop up saying all changes have been saved, it works once, but then won't work a 2ed or 3rd time. code is below:
How can i make it work every time it is click?
$(document).ready(function() {
$(".faChkRnd").on('click', function() {
$("#result").html('All changes have been saved!');
$("#result").addClass("alert alert-fmaj");
});
$("#result").fadeTo(4000, 500).fadeOut(1000, function() {
$("#updateunit").alert('close');
});
$("#updateunit").submit(function() {
return false;
});
});
function clearInput() {
$("#updateunit :input").each(function() {
$(this).val('');
});
}
And also tried this:
$(document).ready(function() {
$(".faChkRnd").on('click', function() {
$("#result").html('All changes have been saved!');
$("#result").addClass("alert alert-fmaj");
});
$("#result").fadeTo(4000, 500).fadeOut(1000, function() {
$("#updateunit").alert('close');
$("#result").removeClass("alert alert-fmaj");
});
$("#updateunit").submit(function() {
return false;
});
});
function clearInput() {
$("#updateunit :input").each(function() {
$(this).val('');
});
}
#resultelement (ie remove thealertclasses, html, etc) so you wouldn't see a change