Custom JS
Hello, I'm try to add custom js to my website... i need to add some css by an <span> to a specific word on all the content...
So...
This is my code:
$('body').html(
function(i,h){
return h.replace(/Contour/g,'<span class="contour">Contour</span>');
});
and jQuery formated:
jQuery(function($){
$('body').html(
function(i,h){
return h.replace(/Contour/g,'<span class="contour">Contour</span>');
});
});
This search on all the body the Word "Contour" to an replace with <span and css class> to change the colour...
The problem is when i add the code to the "Custom js code" on the theme panel the code not works... I try to add manually the code to the header but still not works. The fragment of code is on the html output but not works... i don't know if is for the sintaxis or jquery version but when i change the theme to the Twenty Fifteen my js works.
Please let me know if i'm doing something wrong, maeby some sintax is missing or i need to make other "change" to make it work.... I'm working on a child theme but i try to the main theme to and not works.
Tnks for your help.
Regards.
Comments
what you ask for, requires files customization what in reference to Item Support Policy is not allowed. So if you want to modify files and don't know how, you should contact with your web developer.
Thanks for understanding!