Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(){
  2.     var formEntries = $(".form_entry").get();
  3.     $(formEntries).each(function(){
  4.         var temp = $(this).attr("id");
  5.         console.log(temp);
  6.     });
  7.  
  8.     //Function used for form submission, will have to
  9.     $("#submit-button").click(function(){
  10.         for(x in formEntries){
  11.             if(x.children("input").hasBeenClicked != true){
  12.                 alert("Please fill in all the values before you press submit.");
  13.                 console.log(x.children("input").hasBeenClicked);
  14.                 return;
  15.             }
  16.         }
  17.         $("#submit-button").text("Clicked!");
  18.         alert("You Entered: " + $("#feedback-box").val());
  19.     });
  20.  
  21.     // $("#clear-button").click(function(){
  22.     //  for(x in formEntries){
  23.     //      x.input.hasBeenClicked = false;
  24.     //      x.input.value = default;
  25.     //  }
  26.     // })
  27.  
  28.     $(".form_entry").on("click",":input",function(el){
  29.         var temp = $(el.currentTarget);
  30.         temp.hasBeenClicked = true;
  31.         console.log(temp.hasBeenClicked);
  32.  
  33.     });
  34.  
  35.  
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement