Panos
asked on
Jquery ui selectable problem
Hello experts
I need help with my code.
I'm using jquery 1.7.1 and jquery ui 1.8.18
I want to add an event on selecting but i don't get the right value.
I have a list like:
<ul class="ui-selectable">
<li id="partid_0" class="partselect ui-widget-content ui-selectee">All</li>
<li id ="partid_1" class="partselect ui-widget-content ui-selectee">test 1</li>
<li id ="partid_2" class="partselect ui-widget-content ui-selectee">test 2</li>
</ul>
and script:
$( ".ui-selectable" ).selectable({
selected: function( event, ui ) {
var target = $(this).attr("id");
var i = target.split("_");alert(i)
}
});
I get i undefined
(i need the id value from the selected list but i don't get it. I did not understand the api documentation to fix this)
Any help?
I need help with my code.
I'm using jquery 1.7.1 and jquery ui 1.8.18
I want to add an event on selecting but i don't get the right value.
I have a list like:
<ul class="ui-selectable">
<li id="partid_0" class="partselect ui-widget-content ui-selectee">All</li>
<li id ="partid_1" class="partselect ui-widget-content ui-selectee">test 1</li>
<li id ="partid_2" class="partselect ui-widget-content ui-selectee">test 2</li>
</ul>
and script:
$( ".ui-selectable" ).selectable({
selected: function( event, ui ) {
var target = $(this).attr("id");
var i = target.split("_");alert(i)
}
});
I get i undefined
(i need the id value from the selected list but i don't get it. I did not understand the api documentation to fix this)
Any help?
ASKER
Hi.
I get this TypeError: ui.attr is not a function
I get this TypeError: ui.attr is not a function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much Rainer Jeschor
It is working.
It is working.
Try to change this line:
Open in new window
to:Open in new window