I need to pick id od selectable when Test1 or Test2 are clicked.
<div class="selectable" id="1">
<span class="ui-state-default">Test1</span></asp:Label>
</div>
<div class="selectable" id="2">
<span class="ui-state-default">Test2</span></asp:Label>
</div>
I try somethnig, but i only get first time good value, i get always same value next times.
$(".selectable").selectable({
stop: function() {
$(".ui-selected", this).each(function() {
alert($(".ui-selected").closest("div").attr("id"));
});
}
});
You need to use
$(this)in your.each()function instead of$(".ui-selected"):Otherwise only the first
.ui-selected(and consequently the first parentdiv) will be looked at, and you’ll only get the firstdiv‘s ID.