JQuery display problems?
Posted
by DuH
on Stack Overflow
See other posts from Stack Overflow
or by DuH
Published on 2010-03-23T23:06:45Z
Indexed on
2010/03/23
23:13 UTC
Read the original article
Hit count: 297
I'm new to JQuery and was wondering how can I have Changes saved!
displayed only once even if the user presses the submit button multiple times for example if a user decides to change there info three different times the text, Changes saved!Changes saved!Changes saved!
is displayed i only want Changes saved!
displayed once.
How can I fix this problem? What part of my code needs to be fixed?
Here is the JQuery code.
$(function() {
$('#changes-saved').hide();
$('.save-button').click(function() {
$.post($('#contact-form').attr('action'), $('#contact-form').serialize(), function(html) {
$('div.contact-info-form').html(html);
$('#changes-saved').append('Changes saved!').show();
});
$('a').click(function () {
$('#changes-saved').empty();
$('#changes-saved').hide();
});
return false; // prevent normal submit
});
});
© Stack Overflow or respective owner