My html code is:
<div title="test" class="xyz">Tesing</div>
I want it to look like:
<a href='#'> <div title="test" class="xyz">Tesing</div></a>
How to do it using JavaScript?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As previously said by Curt, your example is not valid. You should have div with text and surround text with ‘a’ tag.
You can use jQuery method
.wrapInner()(jQuery doc)You can do it with a simple line :
jsFiddle is you want to try it :