how can url be hidden in hyperlink when mouse hover

前端 未结 6 1130
心在旅途
心在旅途 2020-11-30 10:46

How can I hide URL from displaying when mouse hovers on a hyperlink?

Hyperlink

How can I hide URL from dis

6条回答
  •  春和景丽
    2020-11-30 11:10

    This way you can easily hide url when mouse hover on hyperlink.

    Simply add one id on anchor link.

    HTML

    Hyperlink
    

    Jquery code

    $(document).ready(function () {
          setTimeout(function () {
    
                $('a[href]#no-link').each(function () {
                    var href = this.href;
    
                    $(this).removeAttr('href').css('cursor', 'pointer').click(function () {
                        if (href.toLowerCase().indexOf("#") >= 0) {
    
                        } else {
                            window.open(href, '_blank');
                        }
                    });
                });
    
          }, 500);
    });
    

    Here is demo link https://jsfiddle.net/vipul09so/Lcryjga5/

提交回复
热议问题