-1

hopefully a quick and easy one. I have a small sample of code (below) that when a class is found in the body, the page h1 title changes to another title. The project I'm working on needs lots of different templates, so I am using jquery to get this done.

The following works:

$(function() {  
if ($(".Class").length > 0) {
      $self = $('.header > h1')
      $self.replaceWith( "<h1 class='classSomething'>" + "New Header 
Title" + "</h1>" );
}
});

However, the page loads and then, the title changes which looks bad. Is there a way to make sure the title changes before we see any of the rendered page?

just to mention, I've tried $(window).load(function.... and this also does the same thing. Maybe a quick pause to let everything load and then, the page shows?

1 Answers1

-1

I think I've figured it out, it's going to be a pain as the template that is picking up the searched for class will only load after the header template which will mean it's going to load after. Think I'm going to have to scrap the idea.