Home>Article>Web Front-end> How to use css method in jquery to make button unclickable

How to use css method in jquery to make button unclickable

coldplay.xixi
coldplay.xixi Original
2021-01-20 11:02:06 1641browse

Jquery uses the css method to make the button unclickable: Use the css method to get the css style of the element, or set the css style of the element, the code is [$('#btn').css('pointer -events', 'none');].

How to use css method in jquery to make button unclickable

The operating environment of this tutorial: windows7 system, jquery3.2.1&&css3 version, DELL G3 computer. This method is suitable for all brands of computers.

Recommended:jquery video tutorial

jquery uses css method to make the button unclickable:

css () method: used to get the css style of the element, or set the css style of the element.

  • pointer-events attribute: Sets or retrieves when the target of the attribute event becomes.

  • auto: The performance effect is the same as when the pointer-events attribute is not specified. Same as visiblepainted value on svg content

  • none: The element will never be the target of mouse events. However, mouse events can be directed to descendant elements when their pointer-events attribute specifies a different value, in which case the mouse event will trigger the parent element's event listener at the capturing or bubbling stage.

Implementation method:

$('#btn').css('pointer-events', 'none');

Effect:

How to use css method in jquery to make button unclickable

##Related free learning recommendations:javascript(Video)

The above is the detailed content of How to use css method in jquery to make button unclickable. 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