开发者

Switch between two divs in JQuery

开发者 https://www.devze.com 2023-04-10 12:56 出处:网络
I am tring to switch between two divs (a small text area and a bigger form field..sort of like twitter). The divs belong to two different classes like

I am tring to switch between two divs (a small text area and a bigger form field..sort of like twitter). The divs belong to two different classes like

<div class = first onClick = "show();" >

<div class = second style = "display:none;">
contains a form that is su开发者_开发问答pposed to redirect to some other .php page via the "action" field
</div>

I have the following javascript

function show()
{
        $(".second").fadeIn('5');
        $(".first").fadeOut('5');

}

When the form in the class = "second" is clicked however the page simply refreshes and div = "first" is displayed (instead of redirecting to the page that the form points to) What am I doing wrong?


It appears there may be an error in the action. The jQuery should really have nothing to do with where the link is directing to.

The problem is likely the form inside <div class="second">.


It works on here:

http://jsfiddle.net/NMMVB/

0

精彩评论

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

关注公众号