Reputation: 1255
I have html like this (note -: I included j library on the top of page )
<div class="WIWC_T1">
<a href="javascript:void(0);" onClick="call_levelofcourse();popup('popUpDiv1')">Level of Course</a>
</div>
to make it not clickable i used jquery like this
$(".WIWC_T1 a").click(function(){
return false ;
});
i tried this too
$(".WIWC_T1 a").off("click");
but onClick="call_levelofcourse();popup('popUpDiv1')" is still working on my page . what is soltuion to do it in very simple way ??
Upvotes: 0
Views: 6679
Reputation: 1953
Another aproach (which not uses jQuery) is to use css class:
.disable-anchor{
pointer-events: none;
cursor: default;
}
and then just add this class to your anchor like:
<a href="javascript:void(0);"
class="disable-anchor"
onClick="call_levelofcourse();popup('popUpDiv1')">
Level of Course
</a>
P.S. check the availability of pointer-events
before using it because this is the CSS3 feature.
Upvotes: 4
Reputation: 1086
To prevent events, like a
when clicking, prevent that event like this:
$(".WIWC_T1").on("click", function(e)) {
e.preventDefault();
//Do your code, such show a popup
}
Upvotes: 1
Reputation: 1055
$(".WIWC_T1 a").on("click", function(){
$(this).attr("onClick", false);
});
Please remember to add Jquery prototype Thanks Vivek
Upvotes: 0
Reputation: 56
<a href="javascript:void(0);" onClick="call_levelofcourse();popup('popUpDiv1')" class="unclickable">Level of Course</a>
function call_levelofcourse(){
if(!$("a").hasClass("unclickable")){
/* your codes here */
}
}
Upvotes: 0