
-
<a id="myAnchor"> Anchor tag </a> <script> document.getElementById("myAnchor").href = "https://www.cnn.com/"; let hrefVal = document.getElementById("myAnchor").href ; document.write(hrefVal); </script>
Using href property on element you can set the href value in javascript. You can use href property for both set and get the value of anchor tag in javascript.
Bootstrap
Cmd
CodeIgniter
Css
Drupal
Git
Html
Javascript
Jquery
Laravel
Nodejs
Php
Python
Sql
Typescript
Wordpress
Random Code Snippet Queries: Javascript
- How to display an image in Javascript onclick
- Deault order of record in datatable
- How to make entire Div clickable in javascript
- Uncaught TypeError: Assignment to constant variable
- How to validate empty space in textbox in Javascript
- Get multiplication in javascript using array input
- Cropper js with multiple images
- Uncaught TypeError: $(...).summernote is not a function
- Prism js horizontally overflowing its container
- Copy one array to another in javascript
- How to get file extension using javascript/jquery
- Generate 6 digit random number in javascript
- Input type file styling
- Concat variable with string in javascript
- How to Set data to localstorage in javascript
- How to crop multiple images with cropper js
- How to show and hide placeholder text
- Execute function with condition in javascript
- How to remove duplicate values from array in javascript
- How to check caps lock is on in javascript
- JavaScript test() Method
- Animating numbers counting Javascript
- How to fixed bootstrap navbar at top on scroll
- Remove hostname from URL in javascript
- How to open modal after redirect