javascript - how to show form on button click using jquery? -


i want form appear when click on button sign up

<div id="signup">     <form action="<?php echo $_server['php_self']; ?>"  method="post"  id="form1">         <input name="user" type="text" placeholder="username" size="30" >         <input name="pass" type="password" placeholder="password"  size="30" >         <input class="btn" type="submit" value="sign up" name="signup"> </div> 

this jquery code:

<script> $( "#form" ).click(function() {   $( "#signup" ).show( "clip", 1000 ); }); </script> 

first of haven't closed form tag, second targeting element id 'form' , of elements have has such id, 1 thing give each input element in form class(signup_txt example) , target elements using css , set property 'display' none hide them this:

.signup_txt{    display:none } 

then give submit button id (signup_btn example) , this:

$("#signup_btn").click(function(){   $(".signup_txt").show();  }); 

and should job here's demo in jsfiddle: http://jsfiddle.net/zdksn35f/


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -