This is my first javascript code. Am trying to change the text within a button to another text after the user’s first click and at the same time have both buttons link to another webpage. I have come up with the code below but it doesn’t work and I honestly don’t know how to link the buttons to another webpage. Need help urgently
I want the buttons to both act as anchors. Such that when a user clicks on the first button (begin wedding planning), she is taken to a webpage but gets to the site a second time the button becomes (continue wedding planning) and is taken to the same webpage as the first button. I reorganizing my script but it still isn’t working
<!DOCTYPE html>
<html>
<head>
<script>
var clickcount=0
var txt = "Begin Wedding Planning!" + ("http://www.app4brides.com");
var txt2 = "Continue Wedding Planning!" + ("http://www.app4brides.com");
function clickCounter(){
if (localStorage.clickcount)
{
localStorage.clickcount=Number(localStorage.clickcount)+1;
}
{
document.getElementById("txt2").value="Continue Wedding Planning!" + ("http://www.app4brides.com");
}
}
</script>
</head>
<body>
<button type="button" onclick="clickCounter()" id="demo">Begin Wedding Planning!</button>
</body>
</html>