jquery - How can i prevent onclick button from multiple click until it's confirmation from javascript if(confirm ) condition -


<input type="button" onclick="return savevalues();" value="<?php echo "values" ?>" class="silver_button_big"> 

on above stop multiclick have tried this.

my_toggle_var = 0; // global variable u can use play  function savevalues() {  if (my_toggle_var  == 0) {     ic.do.something();     my_toggle_var  = 1; // can move down based on need.... } },   : function(){   //some code   //these code lead run jar file   // data insertion db(using mysql)  } 

but unable solve problem in above case, can there may sort of browser cache problem. can me out.

just set disabled="disabled" , readonly="readonly" attributes:

// attach click handler  $(".silver_button_big").on("click", function() {      var $this = $(this);      // disable button    $this.attr({"disabled": "disabled", "readonly": "readonly"});      // async    settimeout(function() {            // enable button      $this.removeattr("disabled readonly");    }, 1000);  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <input type="button" value="click me" class="silver_button_big">

note it's recommended not use empty attribute values.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -