can i use target in div tag? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

can i use target in div tag?

if i click in hyperlink in one div tag the content of the hyperlink is displayed in another div tag..... is it possible or not....

7th Aug 2017, 2:45 PM
Tharanes Thaara
Tharanes Thaara - avatar
2 Answers
+ 3
You can do it with javascript: Place on your div: <div onclick="myFunc()">My text</div> And the JS: function myFunc() { var divWhere = document.getElementById('yourTargetDivId'); var content = '<a href="www.yourlink.com">your link</a>'; divWhere.innerHTML = content; } Please tell us if this runs as expected.
7th Aug 2017, 2:54 PM
Aarón Fortuño Ramos
Aarón Fortuño Ramos - avatar
+ 3
With HTML/CSS? Not to my knowledge. JS/jQuery can easily accomplish such a task though.
7th Aug 2017, 2:56 PM
AgentSmith