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 552157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:28:11+00:00 2026-05-13T11:28:11+00:00

I have a div that is being used as a dialog with jQuery’s .dialog()

  • 0

I have a div that is being used as a dialog with jQuery’s .dialog(). This div has a select box with options. The options the user has already selected are displayed on the main page. They can remove options from the main page and can open the dialog multiple times to add more options.

I populate the select box with all possible options on page load, but then when I open the dialog box I use jQuery’s hide() to hide the options that the user has already selected and are displayed on the main page. This adds the CSS display:none; to the element in question, which IE ignores on <option> tags and displays anyway.

I can easily enough call remove() instead and remove it from the DOM. However, if the user selects some options, them removes them on the main page, then opens the dialog again to select more options, the options are no longer in alphabetical order, the options that were removed from the DOM and put back in it are now at the bottom since I used .append().

Is there any way to get IE to hide <option> tags? Or is there a better way to do this? Or is there a way to insert in alphabetical order simply?

  • 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-13T11:28:11+00:00Added an answer on May 13, 2026 at 11:28 am

    If you need to remove it from the DOM, you could store the options in an array. One array (or object) for each option list. Then removing options from the list itself is reversable. You can always rebuild the select menu again from the array. Just populate the array once the dom-ready event fires.

    Demo online: http://jsbin.com/avuru

    $(function(){ 
    
      // Define variables to be used throughout this code
      var colors     = []; 
      var list       = $("select[name='colors']"); 
      var btnRestore = $("button[name='restore']"); 
      var btnRemove  = $("button[name='remove']"); 
    
      // Cycle through each option, adding its value and text to our collection
      $("option", list).each(function(i, o){ 
        colors.push({ 'key':$(this).val(),'val':$(this).text() }); 
      }); 
    
      // Remove any remaining options, and add collection back into dropdownlist
      $(btnRestore).click(function(){ 
        $("option", list).remove(); 
        for (var i = 0; i < colors.length; i++) { 
          $("<option>").val(colors[i].key).text(colors[i].val).appendTo(list); 
        } 
      }); 
    
      // Remove first option from list - used to test 'Restore' functionality
      $(btnRemove).click(function(){ 
        $("option:first", list).remove(); 
      }); 
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div that is being used an a email newsletter signup form.
I have a div that has it's opacity set to 60. Inside the div,
I have a div that's set to overflow: auto; . This contents of this
I have a div that I have bound the jQuery hover event to activate
I have a footer file that includes links and images. This file is used
I have a toggle event that is being used to show and hide a
i have below function which is being used to initialize a widget. jQuery.fn.initPortlet =
I have the following XSL translator that is is being used to generate some
I have 2 pages. The first page has a dialog that gets populated with
I have multiple DIVs being used to list items like so: <div class=project-item Video>

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.