Can anyone help me with jquery ui selectable please?

My html is:

<input style="" id="input_4" name="input_4" value="" />
                        <ol id="selectable">
                            <li class="ui-widget-content">Reservations </li>
                            <li class="ui-widget-content">Information and Enquiries</li>
                            <li class="ui-widget-content">Mambo Tours &amp; Events</li>
                            <li class="ui-widget-content">Press, Marketing &amp; PR</li>
                            <li class="ui-widget-content">Business Development &amp; Franchise</li>
                            <li class="ui-widget-content">Mambo TV &amp; Livestreaming</li>
                            <li class="ui-widget-content">Mambo Studio</li>
                            <li class="ui-widget-content">VIP Services</li>
                            <li class="ui-widget-content">Merchandise</li>
                            <li class="ui-widget-content">Wedding Planning</li>
                            <li class="ui-widget-content">Club Tickets</li>

and my jquery is:

$(function() {
    $("#selectable").selectable(selected: function(event, ui) { 
            var text = $(this).text();


I want whatever is selected to update the input text field which I want to hide and store the value in.

Anyone please? It's driving me insane with the lack of documentation on jquery ui selectable.



You forgot {} around your options, and this points to selectable, not the selected item.

$(function() {
    $("#selectable").selectable({selected: function(event, ui) { 
            var text = $('.ui-selected').text();
commented: very fast and fixed my dodgy code +3

Thanks for replying but sorry I don't understand where I forgot to put them?

See my snippet, I was editing while you replied ;)

Mate... you just saved me about 5,000 strands of hair!!!!!!! Thank you ever so much!!!!!

is any possible to add jQuery ui selectable for content loaded via AJAx i.e after page load content added automatically like twitter tweet. i tried but it works only page initial page loaded content.