Js replace text and add some html code

Hi there,

in Pro --> Theme Options --> JS

I have this code (that is working)
jQuery(".related.products h2").html("My text");

Now, I’d like to add to “My text” an icon as in the Feature Headlines

So I tried to replacing “My text” with this code “

Mt text

Like this:
jQuery(".related.products h2").html("<h2 class="h-feature-headline h2" ><span><i class="x-icon-ellipsis-v" data-x-icon-s="&#xf142;" ></i>Mt text</span></h2>");

But it’s not working.

What is the right way to obtain it?

Thank you :slight_smile:

Hi There,

Your code is incorrect, please try with this code instead:

jQuery(".related.products h2").html('<h2 class="h-feature-headline h2" ><span><i class="x-icon-ellipsis-v" data-x-icon-s="&#xf142;" ></i>Mt text</span></h2>');

For more information, please take a look at these articles:

Hope it helps :slight_smile:

It’s working. Thank you, also for the information :wink:

You are most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.