Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to change link href with javascript

document.getElementById("foo").href="newPage.php";
Comment

change href javascript

<!DOCTYPE HTML>
<html>

<body>
	<a id="myLinkId" href="abc.com" >Auto update href</a>

	<script>
		var findlink = document.getElementById("myLinkId");
		findlink.href = "xyz.com";
	</script>

</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: js random number 
Javascript :: scrool to top jquerry 
Javascript :: js regex password 
Javascript :: javascript new date zero time 
Javascript :: scroll to bottom of a div react 
Javascript :: print a specific div in javascript 
Javascript :: dummy json 
Javascript :: get element size javascript 
Javascript :: jquery get div height 
Javascript :: can i learn backend before frontend 
Javascript :: select option trigger in js 
Javascript :: remove extra spaces javascript 
Javascript :: js array for in vs for of 
Javascript :: Autocomplete height adjust in materil ui 
Javascript :: expo build 
Javascript :: next.js how to add google fonts 
Javascript :: checking if a character is an alphabet in js 
Javascript :: scroll page to top after ajax success 
Javascript :: jq html remove disabled 
Javascript :: get current url last part angular 
Javascript :: js watch window resize 
Javascript :: moment js cdn 
Javascript :: add icon to text input react native 
Javascript :: javascript json upload 
Javascript :: bright red in javascript 
Javascript :: json user data file sample 
Javascript :: how to add 4 business days in javascript 
Javascript :: js trigger click 
Javascript :: chart js laravel mix 
Javascript :: javascript iterate over json 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =