Append anchor tag

sexxicunt

New Member
In my application, I want to make an image a link to another page. Image is placed in html as,\[code\]<div class="rightbuttoncontainers_footer"> <div class="forfooterimg" id="twitterlink_indv"> <img src="http://stackoverflow.com/questions/12780373/Images/tweatus.png" width="30" height="30" alt="tweat"> </div></div>\[/code\]I want to make those image as links via script, I tried the following\[code\]var twit_lk='https://twitter.com/';$('#twitterlink_indv').append('<a href="'+twit_lk+'"/>');\[/code\]But the output of the above code is like this,\[code\]<div class="rightbuttoncontainers_footer"> <div class="forfooterimg" id="twitterlink_indv"> <img src="http://stackoverflow.com/questions/12780373/Images/tweatus.png" width="30" height="30" alt="tweat"> <a href="https://twitter.com/"></a> </div></div>\[/code\]But, I want the output like the following,\[code\]<div class="rightbuttoncontainers_footer"> <div class="forfooterimg" id="twitterlink_indv"> <a href="https://twitter.com/"> <img src="http://stackoverflow.com/questions/12780373/Images/tweatus.png" width="30" height="30" alt="tweat"> </a> </div></div>\[/code\]How can I make it work?Please help,Thanks
 
Back
Top