Search code examples
jquery-uiselectablejquery-ui-selectable

Dynamic selectees not working in JQuery-UI selectable


I am crating a windows like interface where I have a canvas and into it I can append multiple icons dynamically. I have set the canvas to selectable. The problem is that when I add new icons, I can't select them.

I tried adding ui-selectee class to the icon but it doesn't work either.

$('.canvas').selectable({ 
   filter: $('.icons'),
   autoRefresh: true,  
});

Solution

  • Try to add param 'cancel':

    $('.canvas').selectable({ 
       filter: $('.icons'),
       cancel: 'a',
       autoRefresh: true,  
    });
    

    Or delay param, his helps prevent unwanted selections when clicking on an element. http://api.jqueryui.com/1.8/selectable/