A JS question, I hope you help
I have a layer that is called
He wants to use JS to replace class= "demo" With Id= "demo"
But var str= "" How to write here?
------Solution--------------------
First find the object, obj.id= ' demo '; Obj.classname= ";
------Solution--------------------
You already have an ID, don't you?
?
To modify into
------Solution--------------------
See clearly the question in reply! Come on
Document.body.innerHTML = Document.body.innerHTML.replace (/class=demo/i, ' Id=demo ');
This is a simple way of writing, to give you a clue
Complex and perfect please go to Web Development ――javascript Layout Solution
------Solution--------------------
So I was asking him what was the problem. haha
------Solution--------------------
Jquery
$ ('. Demo '). attr (' id ') = ' demo ';
------Solution--------------------
Explore
See clearly the question in reply! Come on
Document.body.innerHTML = Document.body.innerHTML.replace (/class=demo/i, ' Id=demo ');
This is a simple way of writing, to give you a clue
Complex and perfect please go to Web Development ――javascript Layout Solution
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.