79164794

Date: 2024-11-07 01:56:02
Score: 1
Natty:
Report link

For A Url in jquery:

You Could Try The prop Method:

$(location).prop('href')

Or Try The attr Method:

$(location).attr('href')

Snippet:

function oneurl(){
alert($(location).prop('href'))
}
function twourl(){
alert($(location).attr('href'))
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<button onclick="oneurl()">#1</button>
<button onclick="twourl()">#2</button>

Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Anonymous