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

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

On the above to stop the multiclick i have tried something like this.

my_toggle_var = 0; // your global variable which u can use to play 
function saveValues() {

if (my_toggle_var  == 0)
{
    ic.do.something();
    my_toggle_var  = 1; // You can move it up down based on your need....
}
},

 something : function(){
  //some code
  //these code lead to run some jar file
  // data insertion into DB(using mysql)

}

But this is unable to solve my problem in above case, i can say there may be some sort of browser cache problem. Can somebody help me out.

Ionică Bizău

Just set disabled="disabled" and readonly="readonly" attributes:

// Attach the click handler
$(".silver_button_big").on("click", function() {

  var $this = $(this);

  // Disable button
  $this.attr({"disabled": "disabled", "readonly": "readonly"});

  // Do something async
  setTimeout(function() {
    
    // Enable the button back
    $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 that it's recommended not to use empty attribute values.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I prevent any button click events from queuing until the event handle is finished with the first call

From Dev

How can I prevent a button from clicking a second time when it already has an Onclick event in C#

From Dev

How can I prevent every click on the edit button from opening a JFrame to edit the selected row?

From Dev

How can I prevent multiple ajax queries from being run on "prev" button being clicked multiple times

From Dev

How can I prevent multiple ajax queries from being run on "prev" button being clicked multiple times

From Dev

Button can't be called from onCheckedChanged until I click Switch and click it agan to return to default state

From Dev

Prevent button click from activating <tr> onclick event

From Dev

How can I prevent click event from parent DOM?

From Dev

In AngularJS, how can I prevent a nested <button> from submitting the form that it's in?

From Dev

How to prevent button click from collapsing pane

From Dev

How do I prevent a form from closing and display a confirmation dialog?

From Dev

How to prevent bootstrap modal from closing from button using onclick?

From Dev

How Can I do a listview from a click on button?

From Dev

How can I navigate from fragment to fragment on button click

From Dev

How to stop ios button from functioning until a particular condition is met?

From Dev

When I click on Login button multiple times It loads the other page same number of times the button is clicked.how can I prevent this?

From Dev

How can I prevent javascript assignment from creating ownProperty

From Dev

How can I prevent javascript from copying a line break to clipboard?

From Dev

How can I prevent console from printing in JavaScript game?

From Dev

How can I prevent `[` and `]` to be parsed as array in JavaScript from PHP?

From Dev

How can I prevent the user from clicking a button too fast, in order to prevent an extra ajax request?

From Dev

How to prevent a click from triggering multiple click handler calls in jQuery

From Dev

JavaScript called from Div onclick running button.click call

From Dev

How to prevent Kendo Panelbar from collapsing when I click button which is places on the panelbar itself

From Dev

how can I prevent preventDefault from removing the submit button from $_POST?

From Dev

How can I click on a pin in a Google map embedded from JavaScript?

From Dev

How we can pop element from one table and push the same element in other table when i click the submit button in Javascript?

From Dev

In C# How do I prevent a PreviewKeyDown Event from being presses multiple times until the certain code has complete?

From Dev

How do I get the id of a button from onclick method that I set in javascript within a while loop?

Related Related

  1. 1

    How do I prevent any button click events from queuing until the event handle is finished with the first call

  2. 2

    How can I prevent a button from clicking a second time when it already has an Onclick event in C#

  3. 3

    How can I prevent every click on the edit button from opening a JFrame to edit the selected row?

  4. 4

    How can I prevent multiple ajax queries from being run on "prev" button being clicked multiple times

  5. 5

    How can I prevent multiple ajax queries from being run on "prev" button being clicked multiple times

  6. 6

    Button can't be called from onCheckedChanged until I click Switch and click it agan to return to default state

  7. 7

    Prevent button click from activating <tr> onclick event

  8. 8

    How can I prevent click event from parent DOM?

  9. 9

    In AngularJS, how can I prevent a nested <button> from submitting the form that it's in?

  10. 10

    How to prevent button click from collapsing pane

  11. 11

    How do I prevent a form from closing and display a confirmation dialog?

  12. 12

    How to prevent bootstrap modal from closing from button using onclick?

  13. 13

    How Can I do a listview from a click on button?

  14. 14

    How can I navigate from fragment to fragment on button click

  15. 15

    How to stop ios button from functioning until a particular condition is met?

  16. 16

    When I click on Login button multiple times It loads the other page same number of times the button is clicked.how can I prevent this?

  17. 17

    How can I prevent javascript assignment from creating ownProperty

  18. 18

    How can I prevent javascript from copying a line break to clipboard?

  19. 19

    How can I prevent console from printing in JavaScript game?

  20. 20

    How can I prevent `[` and `]` to be parsed as array in JavaScript from PHP?

  21. 21

    How can I prevent the user from clicking a button too fast, in order to prevent an extra ajax request?

  22. 22

    How to prevent a click from triggering multiple click handler calls in jQuery

  23. 23

    JavaScript called from Div onclick running button.click call

  24. 24

    How to prevent Kendo Panelbar from collapsing when I click button which is places on the panelbar itself

  25. 25

    how can I prevent preventDefault from removing the submit button from $_POST?

  26. 26

    How can I click on a pin in a Google map embedded from JavaScript?

  27. 27

    How we can pop element from one table and push the same element in other table when i click the submit button in Javascript?

  28. 28

    In C# How do I prevent a PreviewKeyDown Event from being presses multiple times until the certain code has complete?

  29. 29

    How do I get the id of a button from onclick method that I set in javascript within a while loop?

HotTag

Archive