开发者

jQuery - fadeIn object after page reload

开发者 https://www.devze.com 2023-03-12 03:43 出处:网络
I have an Ajax based form with 3 radio buttons. When one is checked, div1 fadeIn, if two is checked, div1 fadeOut, div2 fadeIn etc. This part works great.

I have an Ajax based form with 3 radio buttons. When one is checked, div1 fadeIn, if two is checked, div1 fadeOut, div2 fadeIn etc. This part works great.

But I also have success and error notification in those forms, which are not disappearing when radio buttons are switched, so for div2 you can see errors from div1.

I know that I could rename the success and error box classes for each form, but I'm wondering, is there a way I could reload the page or reset the form when switching radio buttons and then needed content would fadeIn? I tried to use location.reload() but it just reloads the whole page,开发者_开发问答 and needed div never fadeIn.

Hope someone could help, I'm a jQuery n00b, but I'm really starting to like this framework.


Use jquerys hide function to hide the notification divs when the radios are clicked:

html:

<div class="notification">There is an error</div>

script:

function onRadioClick() {
    ("div.notification").hide();
    // Do your fade in stuff

}

If I got your question right?


Assuming your success/error area has an id of messageArea, inside your click script:

$('#messageArea').empty(); //Remove contents
//Put your error messages as you would, fade in and out and whatever you wish
0

精彩评论

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