开发者

how to disable link in jquery

开发者 https://www.devze.com 2023-01-06 13:53 出处:网络
my page have a link <a href=\"/hyperlink\">Hyper link</a> i want to open a dialog when user click on link.

my page have a link

<a href="/hyperlink">Hyper link</a>

i want to open a dialog when user click on link.

i want to disable link without remove href event or attribute from him

means no changes in html

then

when 开发者_C百科user click on link then open a dialog

if jquery not load or have a error cause open a link directly.

how i can do this.


$('#myLink').click(function(e) {
    e.preventDefault();
    //do other stuff when a click happens
});

That may work.

0

精彩评论

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