//put it in doument ready method.as globle var var isToPreventDefault=false; //make is ture on any event or your condition. if(yourCondition){ isToPreventDefault = true; } //put it in doument ready method. $("#selectorOfYourAnchor").click(function(e){ if(isToPreventDefault ) event.preventDefault(); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)