Mnia Mnia - 1 year ago 118
jQuery Question

Replace h1 to h2 using Jquery in Wordpress

I m using custom js and css plugin to change the h1 to h2 on a particular page.Here are my codes but it's not working .I have included the external google link in the header.php

<script src="">

<script type="text/javascript">
$(function () {
$('.fancy-title h1').replaceWith(function () {
return "<h2>" + $(this).text() + "</h2>";


enter image description here

Answer Source

It should be $('h1.fancy-title') as you are looking for an <h1> tag with class fancy-title according to your html.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download