javascript - Jquery, get values from <li> tag -
i have list id myid
. can values li values $('#' + i).text()
. using $( '#myid' ).sortable()
. how can values in displayed order? demo here. need implement function in stop:
<ul id='myid'> <li id='1'>value 1</li> <li id='2'>value 2</li> <li id='3'>value 3</li> <li id='4'>value 4</li> <li id='5'>value 5</li> </ul>
use .each()
.text()
: updated fiddle
stop:function(){ $('li',this).each(function(){ alert($(this).text()) }); }
or map()
them array.
stop:function(){ var $li= $('li',this).map(function(){ return $(this).text() }); alert($li) }
Comments
Post a Comment