Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3959160
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:41:45+00:00 2026-05-20T02:41:45+00:00

I was attached the JQuery UI Selectable to an UL element .But the li

  • 0

I was attached the JQuery UI Selectable to an UL element.But the li item which inside were dynamic created.And of course, I couldn’t make selection of them.So, How to attach plugin's function to dynamic created elements in JQuery!?

E.g:

<ul id="selectable">
    <li class="dataItem">item dynamic created here but you can't select me</li>

</ul>

[update]

JQuery code:

$( "#selectable" ).selectable();

and where I use delegate or live!?

the way the delegate and live usage is to bind events in this way:

$('#selectable').delegate('li','click',function(){
  // do something here
});

but the selectable plugin's events are:

Supply a callback function to handle the selected event as an init option.

$( ".selectable" ).selectable({
   selected: function(event, ui) { ... }
});

and the newly added item didn’t get the selectable plugin's state like:

ui-selectee

So,should I re-attach the plugin at every time when a new item added!?

Thank you very much!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:41:45+00:00Added an answer on May 20, 2026 at 2:41 am

    use .live() or .delegate()


    well, for your update, call $( "#selectable" ).selectable(); right after the time you have attach #selectable element in the DOM.

    for example,

    $('#selectable').click(function(){
        alert('I will not fire');
    });
    
    $('body').append('<ul id="selectable"><li class="dataItem">item</li></ul>');
    
    $('#selectable').click(function(){
        alert('I will fire');
    });
    

    alert('I will fire'); will be the only alert triggered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ASP.NET MVC application that has list with jQuery Selectable list. My problem
I'm trying to call a Page Method using a jQuery 'attached' event function, in
I am using JQuery to load content into a div element and everything is
What is the best way to refactor the attached code to accommodate multiple email
I am having check box in the column header. The function of this is
First time using Asp.net-mvc and originally followed the NerdDinner tutorial. My form submit button
I want to create a table where each row has an expandable details row.
I am running some JavaScript on my page. Whenever it catches an event that
I have a drop down in an ASP.NET page. Whenever the value of the
I have the following mark-up: <dt> <input id=p_method_checkmo value=checkmo type=radio name=payment[method] title=Check / Money

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.