Answer the question
In order to leave comments, you need to log in
How to add a link to a div using javascript?
Hello, please help, how to ... add a link "" via javascript?
Thanks in advance
Answer the question
In order to leave comments, you need to log in
<div id="myLink">тут будет ссылка</div>
<script type="text/javascript">
var div = document.getElementById('myLink');
var e = document.createElement('a');
e.href = 'http://google.ru';
e.title = 'это ссылка';
e.appendChild(document.createTextNode('ссылка'));
div.appendChild(e);
</script>
$("#myLink").html('<a href="http://google.ru">ссылка</a>')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question