Using jquery, How would I wrap a div class around the text inside all h1 tags. E.g to make all
<h1> test </h1>
in a document into
<h1> <div class="wrap">test </div></h1>.
I am having a mental block. Any help would be much appreciated.
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.
Try to use use
$('h1').wrapInner('<div class="wrap" />');But use a
<span class="wrap" />Demo jsBin
From the DOCS: http://api.jquery.com/wrapInner/