how to get selected items id in jquery selectables?
This may be a simple question but i could开发者_StackOverflow社区 not find a solution.I wand to get the selected list item id when i select it in jquery selectables.my list is like this
<ol id="selectable">
<li id="one">
<div>one</div>
<div>two</div>
<div>three</div>
</li>
<li id="two">
<div>one</div>
<div>two</div>
<div>three</div>
</li>
</ol>
My jquery code is like this
$( "#selectable" ).selectable({filter: 'li'});
Now what i need is get the id of selected li.ex:if i select on first li then i want the id of it. Thanks for any help.
You could do:
$("#selectable").selectable({
selected: function(event, ui) {
alert(ui.selected.id)
}
});
Fiddle http://jsfiddle.net/LXYUT/2/ (choose item 1)
精彩评论