Does anyone how can I disabled the a tag (link) by using javascript?
Example:
<div class="sub-heading">
Contact Details
<a href="./cust_add_edit_customer.php?action=edit_customer_details&cust_code=12761">
<img class="imgVA editIconPad" src="../images/edit0.gif"
alt="Edit Contact Details" border="0" width="20" height="17">
</a>
</div>
I hope to disabled this a tag after a button been clicked.
I think the most user-friendly approach is to hide the link. In your button click handler do:
document.getElementById('anchorID').style.visibility = 'hidden';
Then to reenable it:
document.getElementById('anchorID').style.visibility = 'visible';
Use an onclick="this.onclick=function(){return false}"
attribute on the a
tag. If there's a lot of buttons, you should iterate through them in a JavaScript script that adds an event listener for click
that is a function that returns false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With