logo logo
  • Articles
  • Snippets
  • Topics
    • Login
    • Register

    • Mode:

fetch anchor tag href value in JavaScript

  • May 22, 2023
  • Snippet ยท 1 min
  • 52 words
  • Share profile in a message
  • Save your profile to PDF
  • Lock profile

  • Profile settings
  • Like (0)
  • Favorite (0)

The below code gives me the full path,

document.getElementById("anchor_tag_id").href; // http://shouts.dev/snippets/anchor-tag-data

and the below code provides the only path,

document.getElementById("anchor_tag_id").getAttribute("href"); // snippets/anchor-tag-data

JavaScript
avatar
Md Najmul Hasan

Similar Stories

JavaScript Disable a Anchor Tag in HTML

snippet

Flat an Multi Dimensional Array in Javascript

snippet

JavaScript What is encodeURI() Function and How it Works

snippet

Javascript Make an HTTP Request

snippet

Turn on multiple window in a single click in JavaScript

snippet
Random Stories

Install SSH Into a VirtualBox Ubuntu Server

snippet

Getting error to install php artisan ui react --auth for Laravel react ui the error is Could not resolve dependency: peer vite@"^3.0.0" from @vitejs/[email protected]

snippet

In Laravel (AND) OR (AND) Query

snippet

Did you forget to use the [uses()] function? get this error after install pest in laravel

snippet

How to Clone a Specific Branch From a Git Repository

snippet