Home>Article>Web Front-end> How to use css method in jquery to make button unclickable
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');].
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:
##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!