The below code gets the full path, where the anchor points:
document.getElementById("aaa").href; // http://example.com/sec/IF00.html
while the one below gets the value of the href
attribute:
document.getElementById("aaa").getAttribute("href"); // sec/IF00.html
More Related Contents:
- Which “href” value should I use for JavaScript links, “#” or “javascript:void(0)”?
- Open URL in same window and in same tab
- HTML tag want to add both href and onclick working
- Why is it bad practice to use links with the javascript: “protocol”?
- What is the difference between the different methods of putting JavaScript code in an ?
- Including both href and onclick to HTML tag
- How can I disable HREF if onclick is executed?
- anchor jumping by using javascript
- how to exchange variables between two HTML pages?
- Add/Remove Class of Nav Objects on Page Scroll
- Executing injected by innerHTML after AJAX call
- How to save an image to localStorage and display it on the next page?
- How to check whether a Storage item is set?
- How to add line breaks to an HTML textarea
- Cache busting via params
- Using an HTML button to call a JavaScript function
- Get the position of a div/span tag
- Why is deprecated and what is the best alternative?
- Set active tab style with AngularJS
- Javascript regex returning true.. then false.. then true.. etc [duplicate]
- how to disable DIV element and everything inside [duplicate]
- How Do I Stop My Web Content From Shifting Left When The Vertical Scrollbar Appears? Roll-Up of Advice 2017 [duplicate]
- D3 Bar Graph example not working locally
- Can I just make up attributes on my HTML tags?
- Why does querySelector only select the first element and how can I fix this?
- How can I set preview of video file, selecting from input type=’file’
- Copy/Paste from Excel to a web page
- onclick event function in JavaScript
- Cross-Origin resource sharing and file://
- Content of html page changed by jQuery but “View Source” don’t reflect the changes