Modify the class of an element in Wordpress

IG Growth

BANNED - Account Sold by Owner
Joined
Jul 2, 2019
Messages
414
Reaction score
303
Hello friends, I need help with a code for a web page that I am creating. I am creating it by means of a plugin that is complete shit (Unyson) what happens is that I need to change a class of one of its elements, when I try to do it directly from the HTML of the Wordpress editor everything loses its shape, I don't know if you understand me.

So, I was reading that there are different ways to change the class. From HTML5, Javascript only or using jQuery. But I really don't know how to do it. I have the idea of how to make the code to delete it, and add a new class, but I don't know how to call it automatically or where to put that code. Anyone have any idea how I can guide myself? Any page that explains this a little better or something like that? Thank you very much.
 
get this plugin wordpress.org/plugins/custom-css-js/
or search worpress plugins for custom css js

It allows you to put jscript/jquery/css on any page easily.

code:
var a = document.getElementById("div1"); //get the element you want to change
if (a.length > 0) { //check if element exists
a.classList.add("mystyle"); //add class
a.classList.remove('unwantedClass'); //remove class
}

//something like that
 
get this plugin wordpress.org/plugins/custom-css-js/
or search worpress plugins for custom css js

It allows you to put jscript/jquery/css on any page easily.

code:
var a = document.getElementById("div1"); //get the element you want to change
if (a.length > 0) { //check if element exists
a.classList.add("mystyle"); //add class
a.classList.remove('unwantedClass'); //remove class
}

//something like that
Thanks for the help mate, and installed the plugin you said and it worked. Thank you very much!
 
Back
Top