jquery ui selectable get id?
问题 How do I get the 'id' of an item in a selectable list, if the list is created dynamically? <ul id="selectable"> <li id='1'>..</li> . . <li... </ul> I tried var num = $('#selecable :selected').attr( "option" , 'id' ); but get only [object Object]... What is the right way? 回答1: Update: For completeness, if an element is selected, the plugin adds a class ui-selected to the element. So you can get the ID of current selected element via: $('#selectable .ui-selected').attr('id'); But be aware that