Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is no straight way to do this (AFAIK), but here's a little hack you can use (and remember, it's just a hack and maybe not the best):</p> <p>Add the css class "selectable" (or whatever you want):</p> <pre><code>&lt;ol id="selectable"&gt; &lt;li class="ui-widget-content selectable" id="ok"&gt; 1&lt;/li&gt; &lt;li class="ui-widget-content selectable"&gt; 2&lt;/li&gt; &lt;li class="ui-widget-content selectable"&gt; 3&lt;/li&gt; &lt;li class="ui-widget-content selectable"&gt; 4&lt;/li&gt; &lt;li class="ui-widget-content selectable"&gt; 5&lt;/li&gt; &lt;li class="ui-widget-content selectable"&gt; 6&lt;/li&gt; &lt;li class="ui-widget-content selectable"&gt; 7&lt;/li&gt; &lt;/ol&gt; </code></pre> <p>And then use a <a href="http://api.jqueryui.com/selectable/#option-filter" rel="noreferrer">filter</a> on that css class:</p> <pre><code>// Create a filter to only make &lt;li&gt; with the specified css class, selectable. var options = { filter: "li.selectable" }; $( "#selectable" ).selectable(options); $('#lol').click(function(){ console.log('dsfds'); // Remove/add (toggle) the class used in the filter on the &lt;li&gt; you want to remove the selectable. // (Also remove the ui-selected in case it's selected.) $('#selectable li#ok').toggleClass("selectable").removeClass("ui-selected"); // Now destroy the selectable and re-create it with the filter again. // We removed the css class from a &lt;li&gt; used in the filter, so it won't be selectable again. $( "#selectable" ).selectable('destroy').selectable(options); }); </code></pre> <p><strong>Updated:</strong> <a href="http://jsfiddle.net/RYWaZ/7/" rel="noreferrer">http://jsfiddle.net/RYWaZ/7/</a></p> <p>References:</p> <ul> <li><a href="http://api.jqueryui.com/selectable/#option-filter" rel="noreferrer">Selectable filter</a></li> <li><a href="http://api.jquery.com/toggleClass/" rel="noreferrer">.toggleClass()</a> </li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload