emprit

klik-input

Jun 4th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.75 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <style>
  5.   span { display:none; }
  6.   div { display:none; }
  7.   p { font-weight:bold; background-color:#fcd; }
  8.   </style>
  9.   <script src="http://code.jquery.com/jquery-latest.js"></script>
  10. </head>
  11. <body>
  12.  
  13. <button>Do it!</button>
  14.  
  15. <div>
  16.   <form>
  17.     <input type="text"  value="as;ldkfjalsdf"/>
  18.   </form>
  19. </div>
  20.  
  21.  
  22. <script>
  23. function doIt() {
  24.   $("span,div").show("slow");
  25. }
  26. /* can pass in function name */
  27. $("button").click(doIt);
  28.  
  29. $("form").submit(function () {
  30.   if ($("input").val() == "yes") {
  31.     $("p").show(4000, function () {
  32.       $(this).text("Ok, DONE! (now showing)");
  33.     });
  34.   }
  35.   $("span,div").hide("fast");
  36.   /* to stop the submit */
  37.   return false;
  38. });
  39. </script>
  40.  
  41. </body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment