Is there a "clean" way to insert an item in a jQuery UI Selectable control?
Say, I have the following Selectable:
<div id="selectable">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</div>
I could manually insert a row like:
$('<div>Item 4</div>').addClass('ui-selectee').appendTo($('#selectable'));
While it visually looks correct, is there any events I need to include as well? Is that a clean way to insert an item, or is there a better way?
There's no api for doing it. So I believe your coding is a correct way. You may also try to call the .selectable( "refresh")
after addition.