I want to have a div element set to not be clickable and then set it to clickable after another element is clicked.
So, when .case is clicked:
$('.case').click(function() {
$('#patient').addClass('active').on('click');
});
But how do I set #patient to unclickable in the first instance when I have further down:
$('#patient').click(function() {
alert('clicked');
});
To make a link unclickable using CSS, you can use the pointer-events property. pointer-events: none; on the link that you want to make unclickable and it will not let you click the link.
$('#patient').on('click', function() {
if ( $(this).hasClass('active') ) {
// do whatever when it's active.
}
return false;
});
If you just want it to not accept, you can add this to your css (pointer-events):
#patient { pointer-events: none; }
#patient.active { pointer-events: auto; }
Non clickable:
$("#ElementName").css("pointer-events","none");
Clickable:
$("#ElementName").css("pointer-events","auto");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With