开发者

jQuery display problem?

How do I hide the #changes-saved code using jQuery?

For example let's say the code is displayed when the user clicks the submit button and then leaves the current web page and then returns back to 开发者_如何学Cthe web page and the #changes-saved is no longer displayed until the submit button is clicked again.

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('<li>Changes saved!</li>').show().pause(1000).hide();
        });
        return false; // Prevent normal submit.
    });
});


On page load keep the div hidden...

<div id = 'changes-saved' style='display:none'>
  some stuff
</div> 

On button click change the div's css like...

$('#changes-saved').css('display','block');

hope this helps.. cheers...!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜