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 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/
精彩评论