How to temporary disable the click function when it is executing?

How about this or something similar:

<script type="text/javascript">
    // disable command while function is being executed.
    var sample = { 
        isExecuting : 0, 
        doWork : function (e) { 
            if (sample.isExecuting === 1) return;
            sample.isExecuting = 1;
            // do work -- whatever you please
            sample.isExecuting = 0; // say: I'm done!
        }
    };
    // live or bind
    $("#prevPage").bind("click",function(e) {
         sample.doWork(e);
    });
</script>

simple 'shield' to block a multiple-call scenario.


Then set a flag on the element to check if it's clickable or not.

$("#prevPage").on("click",function(e) {

  e.preventDefault();

  //get the clickable attribute
  //if it's not existent, its undefined hence "false"
  var unclickable = this.unclickable;

  //if it's not unclickable (it's clickable)
  if(!unclickable){

    //make the flag unclickable
    this.unclickable = true;

    //do stuff

    //reset it back the way it was after operations
    this.unclickable = false;
  }


});