html lists and js
-
There is a html document containing a simple list of several elements. We need a mice slick on the element, its contents are in js-ocno alert. How do you realize what attributes to complete the list, etc?
-
JQuery:
$('li').click(function(){ alert($(this).html()); });
pure_js:
function(){ var li_elements = document.getElementsByTagName('li'); for(var i=0; i< li_elements.length; i++){//timka_s, +1 li_elements[i].onclick = function(){ alert(li_elements[i].innerHTML); } } }();