Advertisement
monaliza86

Untitled

Feb 21st, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <script src="jquery-3.3.1.js"></script>
  3. <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  4. <script>
  5. var go = function() {
  6.     //do some stuff here
  7.     //alert();
  8.     console.log ($(".clsAddress").val());
  9.     console.log($("#name").val());
  10.     //widgets
  11.    
  12.  
  13. }
  14. $(document).ready ( function(){
  15. //makes sure this code only runs after the DOM is loaded
  16.    
  17.     $("#btnSubmit").click(go);//jQuery selector by ID
  18.     $(".clsAddress").val("hello");//selector by class
  19.     //$("h1").text("COOL JQUERY");//selector by tag name
  20.     $("#wrapper").accordion();//accordion widget
  21.     $("body").redHeaders();
  22.  
  23. }
  24.  
  25.  
  26. );
  27.  
  28. //template to create your very own jQuery plugin
  29. (function($) {
  30.     $.fn.redHeaders = function() {
  31.         //return "this" to make sure we support chaining
  32.         //and iterate all selected elements
  33.         //declare variables and objects here
  34.         return this.each(function() {
  35.             /*var headers= this.getElementsByTagName("h1");
  36.             for(var i=0;i<headers.length;i++){
  37.                 headers[i].setAttribute("class","red");
  38.             }*/
  39.             $("h1").attr("class", "red");
  40.            
  41.                
  42.             //most of your code will go here
  43.         });
  44.     };
  45. })(jQuery);// invoke IIFE(immediately invoked function expression
  46. //and import jQuery object. IIFE ensures variables will go
  47. //out of scope as soon as the function completes so it won't
  48. //clog up the global namespace
  49. </script>
  50. <style>
  51. .red {
  52.     background-color: red;
  53. }
  54. .white {
  55.     background-color: white;
  56. }
  57. </style>
  58. <body>
  59.     <main>
  60.         <div id="wrapper">
  61.             <h1>Registration Form</h1>
  62.             <div id="personal">
  63.                 <label>Name</label>
  64.                 <input type="text" id="name">
  65.                
  66.                 <br>
  67.  
  68.                 <label>Address:</label>
  69.                 <input type="text" class="clsAddress" id="address" ><br>
  70.  
  71.                 <label>Phone Number:</label>
  72.                 <input type="text" id="phonenum" ><br>
  73.  
  74.                 <label>Email Address:</label>
  75.                 <input type="text" id="email" ><br>
  76.  
  77.                 <label>Birth Date:</label>
  78.                 <input type="text" id="birthdate" ><br>
  79.                 <input type="button" value="Submit" name="btnSubmit" id="btnSubmit"><br>  
  80.                
  81.             </div><!--end content div-->
  82.             <h1>Billing info</h1>
  83.             <div id="personal">
  84.                 <label>Credit Card Number:</label>
  85.                 <input type="text" id="ccnum" ><br>
  86.                 <label>Expiry Date:</label>
  87.                 <input type="text" id="ccexpiry" ><br>
  88.                 <label>CVV:</label>
  89.                 <input type="text" id="cvv" ><br>
  90.             </div><!--end personal data-->
  91.         </div><!-- end wrapper div-->
  92.     </main>
  93. </body>
  94. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement