Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent the click event using CSS?

Tags:

html

css

How to prevent the click event using CSS ?

I have created the form page , then i need to prevent the click event using only CSS?
I have tried this css property, but not worked.

<div>Content</div>
div {
  display: none;
}
like image 676
M K Avatar asked Jun 23 '17 11:06

M K


People also ask

How do you stop a click event in CSS?

Conclusion. To disable clicking inside a div with CSS or JavaScript, we can set the pointer-events CSS property to none . Also, we can add a click event listener to the div and then call event. preventDefault inside.

How do I restrict clicking events in HTML?

You can't prevent click with css, you must use javascript. The dislpay:none only hide a element, in this case, a div.


1 Answers

You can try the css class:

.noClick {
   pointer-events: none;
}
like image 172
kevinSpaceyIsKeyserSöze Avatar answered Oct 08 '22 23:10

kevinSpaceyIsKeyserSöze