开发者

Jquery: stopping navigation into link when it has javascript embeded

开发者 https://www.devze.com 2023-01-29 14:42 出处:网络
When I am dealing with links with Javascript embeded, <a onclick=\"return tnNav2Evt391(this,\'\');\" href=\"#\" class=\"\">link</a>

When I am dealing with links with Javascript embeded,

<a onclick="return tnNav2Evt391(this,'');" href="#" class="">link</a>

I want to stop the execution of Javascript and highlight it.

With normal links without Javascript embeded, I am able to stop default navigation:

function processAction(e){  
    var clicked = e.target;
    switch(clicked.tagName)
    {
        case "A":       
            return false; // prevent the default action, e.开发者_运维技巧g., following a link
        break;
        }
}


try

$('a').removeAttr('onclick').click(function(event) { 
    event.preventDefaut();
    //write the logic herer
});

It'll prevent click default event.

0

精彩评论

暂无评论...
验证码 换一张
取 消