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

  • SEARCH
  • Home
  • 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 9231055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:58:31+00:00 2026-06-18T05:58:31+00:00

I want to disable a specific element of a selectable list. I am able

  • 0

I want to disable a specific element of a selectable list.
I am able to disable the whole list, but when I try with specific element, it doesn’t work.

$('#disableButton').click(function(){  

    $('#selectable li#b ').selectable('disable');
});

http://jsfiddle.net/Komlan/RYWaZ/1/

Here is my code

    //reset seats
function resetSelect(){
    var options = { filter: "li.selectable" };
$( "#selectable").selectable(options);               

}
//Ajax get taken seats
$('input[name="choice"]').change(function(){
    resetSelect();
    var sc_id = $('input:radio[name=choice]:checked').val();

    $.ajax({
        url: 'seatings.php',
        data:{ sc_id:sc_id},
        type: "POST",
        dataType:'text',
        success: function(data){
             var id = data.split(",");
             for (var i=0;i<id.length -1;i++){
             alert(id[i]);
                var string = "#"+id[i];
                $(string).css("color","red");
                $('#selectable li'+string).removeClass("selectable ui-selected"); 
             }
                var options = { filter: "li.selectable" };
            $( "#selectable" ).selectable('destroy').selectable(options);                
        }

    }); 
});

In summary, I’m getting a series of id and disable them one after the other, every time there is a change on my radio button group.

  • 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-06-18T05:58:33+00:00Added an answer on June 18, 2026 at 5:58 am

    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):

    Add the css class “selectable” (or whatever you want):

    <ol id="selectable">
      <li class="ui-widget-content selectable" id="ok"> 1</li>
      <li class="ui-widget-content selectable"> 2</li>
      <li class="ui-widget-content selectable"> 3</li>
      <li class="ui-widget-content selectable"> 4</li>
      <li class="ui-widget-content selectable"> 5</li>
      <li class="ui-widget-content selectable"> 6</li>
      <li class="ui-widget-content selectable"> 7</li>
    </ol>
    

    And then use a filter on that css class:

    // Create a filter to only make <li> 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 <li> 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 <li> used in the filter, so it won't be selectable again.
        $( "#selectable" ).selectable('destroy').selectable(options);
    });
    

    Updated: http://jsfiddle.net/RYWaZ/7/

    References:

    • Selectable filter
    • .toggleClass()
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to enable deprecated errors globally but disable them for a specific piece
I want to disable a cck field inside a specific form in Drupal 6.
I want to disable click on a certain <div> so that when you select
I want to disable a specific wifi connection which is entered by the user.
I want to disable only checkboxes that are checked AND have a specific class.
I have UIView that open with a UIButton click. I want to disable user
I want to enable/disable a checkable item in a QTreeWidget, when a specific signal
I want to disable a specific warning (W1035) in my code, since I think
I want to disable one specific row in datagrid in following manner: 1) Highlight
I want to disable text selection for specific elements. For example: p { -moz-user-select:

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.