I have my css file already loaded up but I want to replace some old class name with a new name. Is that possible?
Maybe something like this but I dont know how to access the css text itself..
innerHTML.replace(".someClass",".newClass")
;
Cheers
I guess it's theoretically possible by loading the file with the file system plugin construct.net/en/make-games/manuals/construct-3/plugin-reference/filesystem
BUT I am almost certain that that's not what you want to do? If you just want to change an old class name to a new one... why don't you just edit the file in the editor?
The files are in the project bar on the right side, doubleclick to open, edit as you wish, ctrl+s.
Develop games in your browser. Powerful, performant & highly capable.
You can change the classes (and pretty much anything else) in already-loaded HTML with the JavaScript DOM APIs. In this case classList can be used to change an element's classes. For example:
const myElem = document.getElementById("myElem"); myElem.classList.remove("oldClass"); myElem.classList.add("newClass");