javascript - jQuery double-submit protection not working in safari -


we have payment details form our client, , when "next" button clicked more once, have protection doesn't allow 2 policies created.

it works in chrome, firefox, , internet explorer 8!!!! sadly, it's not working in safari.

could please take @ code below , out this?

    $("form").submit(function(event) {     //validate     if( $(this).find(".e-clicked").attr("id") === "next" ) {          $( ).find("input[type='submit']").removeclass("e-clicked");     // console.log("submit event: " + event.srcelement);         resetglobalerrors();         if (fieldsets.get("your-payment").isvalid(true)) {             //protect submit if it's validated ok             var val = $("input[type=submit]:focus").val();             var clicked = $("input[type=submit]:focus")                     .hasclass("preventsubmit");                  if (val == "next") {                 if (!clicked) {                     $("input[type=submit]:focus").addclass(                             "preventsubmit");     //                      console.log("not clicked")                 } else {                     event.preventdefault();     //                      console.log("clicked")                 }             }                            return true         } else {     //              $("#next").removeclass("preventsubmit");             event.preventdefault();                           return false;         }     }; });   $(".change-details").click(function() {      $(this).parent().hide();     $(this).parent().next().show(); });     });       $("#next").click(function(e){  $(this).addclass("e-clicked"); //define submit clicked adding class      }); 

see html below:

            <div>                 <label for="yourpayment!input_application_selectedpaymentdate">* date want payment leave account each month?</label>                 <select class="paymentdate medium" id="paymentdetails_application_selectedpaymentdate" name="application.selectedpaymentdate"> <option value="-1">choose...</option> <option value="1">1st</option> <option value="2">2nd</option> 

            </div>             <div>                 <label>* name of account holder:</label>                 <input type="text" class="accountholder wide first-child justletters" id="accountholder" value="" name="application.accountdetails.accountname">                </div>             <div class="field-div">                 <label>* account number:</label>                 <input type="text" class="accountnumber wide first-child justnumbers" id="paymentdetails_application_accountdetails_accountnumber" value="" name="application.accountdetails.accountnumber">                </div>             <div class="field-div">                 <label>* sort code:</label>                 <input type="text" class="tiny sort-code sortcode1 first-child justnumbers" id="sort_code" value="" maxlength="2" name="application.accountdetails.sortcodefragment1">                 <input type="text" class="tiny sort-code sortcode2 justnumbers" id="sort_code" value="" maxlength="2" name="application.accountdetails.sortcodefragment2">                 <input type="text" class="tiny sort-code sortcode3 justnumbers" id="sort_code" value="" maxlength="2" name="application.accountdetails.sortcodefragment3">              </div>         </div>      </div>  </fieldset>  <div>       <input type="submit" value="back" name="action:yourpayment!back" id="back">      <input type="submit" value="save details" name="action:yourpayment!save" id="save">      <input type="submit" value="next" name="action:yourpayment!execute" id="next">  </div> 


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -