Is it possible to disable an <a href="#" onclick..../> after the first click. I have link that calls an AJAX class and I want to prevent double clicks. Here is my link:

echo '<a href="#" class="cartLineDeetButton" onclick="processURL(\'includes/ajaxRequest.php?cmd=doProcessURL\', \'invUserIDACH\', \'postedWrapACH\', \'<img src=images/ajax-loader.gif />\');">';
 echo 'Submit';
 echo '</a>';

I was reading you can do e.preventdefault(this); How would I pass "this" in the function since it already has parameters?

    I would expect that if the click handler — when it is first called — changed the link's click handler to "return false;" then the link wouldn't react to future clicks (the original click handler would have been replaced).

      11 days later

      An alternative to modifying the link might be to set a flag var in your JS that indicates the process is busy and have your processURL function check that flag before proceeding. If you have many links and only one processURL function, it might be more involved.

        Write a Reply...