Created
February 18, 2013 04:38
-
-
Save shaik2many/4975147 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
| <script> | |
| $(function() { | |
| $("#mybutton").click(function() { | |
| alert($("#myform").serialize()); | |
| }); | |
| $("#myname").change(function(){ | |
| if(this.value.length<5)$("#namerror").html("Name should be at least 5 chars") | |
| else $("#namerror").html("") | |
| }); | |
| }); | |
| </script> | |
| </head> | |
| <body> | |
| <form id="myform"> | |
| Name: <input type=text name="myname" id="myname"><span id="namerror"></span><br> | |
| Destination: <select name="place"><option>Earth</option><option>Mars</option></select><br> | |
| Gender: <span class='padleft'>Male<input type=radio name="gender" value="male"> Female<input type=radio name="gender" value="female"></span> | |
| </form> | |
| <input type="button" id="mybutton" value="Show Me Form Data.."> | |
| </body> | |
| </html> | |
| <style> | |
| input[name='myname']{ margin-left:100px; } | |
| select { margin-left:70px; } | |
| input[id='mybutton']{ margin-left:200px; } | |
| .padleft{margin-left:92px;} | |
| #namerror{color:red;} | |
| </style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment