Change element from home page

On my page https://getsatisfaction.com/gsfnmichelle/products , there is a breadcrumb chain that says "Products". I am trying to change this to "Categories". I can get it to do it in the inspector, but when I put the code in the setup script (which is just the main / gsfnmichelle page on the platform I use) it doesn't work.

Even though I was able to get the correct element (jQuery ('. Crumb_link span');) and change it using (jQuery ('. Crumb_link span'). Text ('Categories');), I can' t figure out how to change its when it's on a different page (/ products) other than the main page (/ gsfnmichelle), as that's the only place where we can insert the configuration code.

I thought that something like this would check in the page and change this element, but that doesn't work:

jQuery(document).ready(function () {
    if (window.location.pathname =="/gsfnmichelle/products") {
        jQuery('.crumb_link span').text('Categories');}
};

      

Then I tried using an if statement to test the correct element, but that doesn't work either:

jQuery(document).ready(function () {
    if (jQuery('.crumb_link span').text =='Products') { 
        jQuery('.crumb_link span').text('Categories');}
};

      

What am I missing?

+3


source to share


1 answer


You probably want to use either if (jQuery('.crumb_link span').text() == "Products")

or jQuery('.crumb_link span:contains(Products)').text('Categories')

.



Your current state will never be true.

+3


source







All Articles