I know that
$('p.heading').replaceWith('Welcome');
will replace the entire <p> tag with the text ‘Welcome’
How do I just replace the contents, so I end up with <p class="heading">Welcome</p> ?
Perhaps replaceWith is the wrong function?
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.
The
.html()function replaces the inner HTML of the matched element with its argument (or returns the inner HTML of the matched element if it is called without an argument).