Home >Web Front-end >JS Tutorial >How to make a tag unavailable in jquery

How to make a tag unavailable in jquery

coldplay.xixi
coldplay.xixiOriginal
2020-12-02 15:24:102604browse

Jquery method to make the a tag unavailable: 1. Remove the href attribute in the a tag, the code is [$('.disableCss').removeAttr('href')]; 2. Remove the href attribute in the a tag Onclick event, the code is [$('.disableCss').remo].

How to make a tag unavailable in jquery

The operating environment of this tutorial: windows7 system, jquery3.2.1 version, Dell G3 computer.

Jquery method to make the a tag unavailable:

Remove the href attribute in the a tag

$('.disableCss').removeAttr('href');

Remove the onclick event in the a tag

$('.disableCss').removeAttr('onclick');

If there is a data-toggle to switch the tab page attribute, you need to add a

$(".disableCss").removeAttr('data-toggle');

At this time, the a label is no longer clickable, but when the mouse is moved up, the font will still change color

Related learning recommendations: javascript video tutorial

The above is the detailed content of How to make a tag unavailable in jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn