Reputation: 41
On clicking the number should change the class and title from not_viewed to viewed making color change from red to green .But obviously,it is not working as no color change is occuring.
Html
<span title="not_viewed" class="not_viewed" id="1" onclick="javascript:changeclass()">1</span>
Javascript
function changeclass() {var NAME = document.getElementById("1"); NAME.className = "viewed" NAME.title="viewed"
< /script>
}
css
span.viewed{color:green; }
span.not_viewed{color:red;}
span{cursor:pointer;}
See http://jsfiddle.net/yKbFk/1/
Upvotes: 0
Views: 85
Reputation: 8379
Remove < /script>
tag from function.
Check it here http://jsfiddle.net/yKbFk/6/
Upvotes: 1