Home > Article > Web Front-end > jquery a tag is not available implementation method
jquery How to implement the unavailable a tag: First create a sample file; then use jQuery to make the a tag unavailable, with statements such as "if (boolean) {$("a").attr( "disabled", true)...}".
The operating environment of this tutorial: windows7 system, jquery1.10.0 version, Dell G3 computer. This method is suitable for all brands of computers.
Recommendation: "jquery video tutorial" "javascript basic tutorial"
##jquery makes a tag unavailable
Sometimes, we need to make the a tag unavailable under certain conditions. However, due to the special nature of the a tag, just adding the disabled attribute to it can only make it gray, and it will still jump when clicked. transfer, so other processing is required. Here is a method of using jQuery to make a tag unavailable:if(boolean){ $("a").attr("disabled", true); $("a").click(function(){}); }In fact, it is to gray out the tag and set its jump function to empty, native JS and other frameworks can be implemented by referring to this method. or
$("a").attr("disabled", true); $('.disableCss').removeAttr('href');//去掉a标签中的href属性 $('.disableCss').removeAttr('onclick');//去掉a标签中的onclick事件If there is a data-toggle switch attribute of the tab page, you need to add a $(".disableCss").removeAttr('data-toggle');
The above is the detailed content of jquery a tag is not available implementation method. For more information, please follow other related articles on the PHP Chinese website!