this.href vs $(this).attr('href')

前端 未结 3 1101
醉酒成梦
醉酒成梦 2020-11-27 17:39

After reading this article net.tutsplus.com/tutorials/javascript-ajax/14-helpful-jquery-tricks-notes-and-best-practices/ I came to conclusion that using this.href<

3条回答
  •  天命终不由人
    2020-11-27 18:38

    what a but a little substring?

    for example :

    function getHref(a)
    {
        var i = a.outerHTML.indexOf('href="')+6;
        return a.outerHTML.substring(i, a.outerHTML.indexOf('"', i));
    
    }
    

    P.S TESTED!

提交回复
热议问题