Forum Moderators: open
<div id="rating">
<span id="s1" title="1 Star">★</span>
<span id="s2" title="2 Stars">★</span>
<span id="s3" title="3 Stars">★</span>
<span id="s4" title="4 Stars">★</span>
<span id="s5" title="5 Stars">★</span>
</div>
<script type="text/javascript">
<!--
document.getElementById("rating").onmouseover = function(){
console.log('The span id moused over is');}
document.getElementById("rating").onclick = function(){
console.log('The span id clicked on is');}
//-->
</script>
document.getElementById("rating").onmouseover = function(event){
event = event || window.event;
var target = event.target || event.srcElement;
console.log('The span id moused over is ' + target.id);
}
document.getElementById("rating").onclick = function(event){
event = event || window.event;
var target = event.target || event.srcElement;
console.log('The span id clicked on is ' + target.id);
}
In regards to removing the HTML comments, is it just because modern day browsers all support JavaScript?