Show hidden link or links onclick

0 Luka Roguljic · September 18, 2015
Can someone help me with my problem?

lets say you have index.html, and in index.html you have link1 that you can see when page is loaded.

when you click link1 it opens in new tab www.google.com, but at same time you click link1 it shows link2(link2 is hiddden at first) on index.html?

is this less confusing

Ty

Post a Reply

Replies

Oldest  Newest  Rating
0 Tincu Andrei · September 20, 2015
something like this?


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>show link</title>
<style>
#hidden_link{display:none;}
</style>
</head>
<body>


<a id="link1" href="http://google.com" target="_blank">google</a>
<a href="#" id="hidden_link">link2</a>

<script>
var link1 = document.getElementById('link1');
var link2 = document.getElementById('hidden_link');
link1.addEventListener('click', function(){
link2.style.display = "inline-block";
});
</script>
</body>
</html>
0 Luka Roguljic · September 19, 2015
sorry for bad question,

ill try to make it less confused.
0 Bernard Pyc0d333 Parah · September 19, 2015
Im more confused after reading the question
0 Jagdeep Matharu · September 19, 2015
:'(:dizzy:

try giving more details, :)
  • 1

Javascript

107,010 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators