0
can i use this "elememt.className.replace(cl2,cl1)" Instead of this "element.className = elememt.className.replace(cl2,cl1)"
I want to replace a class with other class but when i wamt to do that with className.replace method i have to store it or assign it into element.className Like "element.className = elememt.className.replace(cl2,cl1)" but I want to write it directly like this "elememt.className.replace(cl2,cl1)" But it shows an error why it shows error can someone please explain
3 odpowiedzi
+ 1
Quoting from https://www.w3schools.com/jsref/jsref_replace.asp
"Definition and Usage
The replace() method searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replaced."
The method returns a modified copy of the calling object data.
+ 1
Ipang thanks bro
0
Cool bro 👍👌