<a href='/a01'></a>
If I were to check .href of that using javascript, it would give the full path, instead of /a01.
Using getAttribute does return the full path, however it is much slower than .href. Is there a fast way to get the actual href?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re saying that you only want the path, then use the
.pathnameproperty instead of the.hrefproperty.There are also
.searchand.hashfor the querystring and hash tag. There are a number of others as well.Another option is…
…but I’d be surprised if it was quicker. I’m not certain of browser compatibility issues either.
And another few…
If the
.valueproperty gives you trouble in older browsers, trynodeValue.