Get the full URI from the href property of a link

后端 未结 4 554
粉色の甜心
粉色の甜心 2020-12-13 14:07

I would like to have a confirmation on some point.

My goal is to always get the same string (which is the URI in my case) while reading the href property from a link

4条回答
  •  [愿得一人]
    2020-12-13 14:37

    I know it's an old question, but this being actually the first entry that popped up, I believe it's good to add an extra solution. Ever since jQuery introduced the "prop" function, getting the full URL is as simple as:

    $(my_a_dom_node).prop('href');
    

    I hope that still helps somebody.

提交回复
热议问题