Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Post
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Reply
how to restore the list element style on clicking other elem
noor unnisa
8 years ago
380
Reply
I am creating list elements dynamically and the list element color should change when we click on it,.
this functionality am getting through the following code:
function addLeaf(sText) {
var element = null;
try {
element = document.createElement("li");
element.innerText = sText;
element.style.cursor = "pointer";
element.onclick = function (event) {
element.style.color = "red";
};
but when i clicked another list element ,the first clicked list element should become normal ie,.in black color,.
if anyone can help
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
how to add advertisements in website
How to prevent a tag of getting Css from Master page