Reputation: 50800
I have multiple links which have the class "disable" defined in CSS.
Now for iPad, I want on click of the link, nothing should happen i.e. link should not get clicked (currently it navigates to some URL)
How do I handle this through CSS only? I know it can be done through JavaScript/jQuery...But there are a lot of pages and I need to do this through CSS.
Upvotes: 0
Views: 881
Reputation: 73966
I mostly use this to disable links on my web-apps:
a.someClass {
pointer-events: none;
cursor: default;
}
Hope, this will work on the iPad
too. Fiddle Demo
Upvotes: 1
Reputation:
You can use this trick:
<button disabled>Hello World</button>
// This will never run
$(function() {
$("button").click(function() {
alert("Hello World");
});
});
button {
padding: 0;
border: 0;
background-color: inherit;
color: Blue;
cursor: pointer;
}
Upvotes: 0
Reputation: 40639
I think it can't be done in CSS
.
But, as you said that there are lots of pages
, so you do not able to change everywhere, its false.
You can create a common javascript file
and add it in every pages.
You can use this code in jquery
$('.disable').on('click',function(e){
e.preventDefault();
return false;
});
Upvotes: 0