html - Javascript - extract span value -


hi there wondering how span value="example" object using javascript.

playlist = document.getelementbyid("list"); playlist.addeventlistener("click",playnext,false);    function playnext(){  var next = playlist.value;      alert(next); } 

as html

<span id="list" value="neededvalue">object1</span> 

i unable extract "neededvalue" span object, have had success returning innerhtml span.

thanks,

you want use data attribute store value. here article on , how use them http://html5doctor.com/html5-custom-data-attributes/


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -