algorithmicCoder
algorithmicCoder

Reputation: 6789

Switch between two divs in JQuery

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 supposed 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?

Upvotes: 0

Views: 570

Answers (2)

Fishz
Fishz

Reputation: 465

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">.

Upvotes: 1

nambrot
nambrot

Reputation: 2571

It works on here:

http://jsfiddle.net/NMMVB/

Upvotes: 0

Related Questions