I have stopped a link / anchor tag trigger event when it clicked by using the preventDefault()
and in the middle of the jQuery function, I want to trigger the link by disabling the preventDefault()
. Below you can see my code block,
jQuery(".tcf_add_to_cart a").on('click', function( e ){
e.preventDefault();
if( some condition )
{
$.ajax({
type : "POST",
data : data,
url : 'url',
success : function( response ) {
if ( response == 'true' )
{
// ENABLE THE LINK AND TRIGGER LINK ACTION
}
}
});
}
});
as mentioned above I need to enable the blocked link and what is the best & right wayto do this.