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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:00:13+00:00 2026-06-16T03:00:13+00:00

I have two jQuery EasyUI Combobox in which I have a list of items.

  • 0

I have two jQuery EasyUI Combobox in which I have a list of items. Each combobox has exactly the same list of items. What I’m trying to do is that when I select one item from the first combobox, I want the selected item to be unavailable on the second combobox (and vice versa). I did this by using the replaceWith() method of jQuery like:

$('#old_element').replaceWith('#new_element');

That works fine as you can see from that DEMO. But the problem I have is that, when an item is replaced in a combobox, I can no longer click on the replaced item. For example, if you select Java in combobox1, Java will be removed from combobox2 (you’re left with only Perl and Ruby), now if you select Ruby in combobox1, it will replace Ruby in combobox2 by the old value of combobox1 (which is Java), but now if you try to click on Java in combobox2, it does not work (I cannot click). Can anybody tell me how I can solve this situation. There seems to be also some empty divs that are added to the list when I replace an element from that list by another one. Any idea how can I resolve these issues please?

You can view the code in THAT DEMO

  • 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-16T03:00:15+00:00Added an answer on June 16, 2026 at 3:00 am

    You are doing it the hard way. I will make two assumptions for simplicity to explain how you can achieve that without screwing up the low level markup which you shouldn’t be using.

    1. Move your data from the markup to JavaScript.

      var data = [
        { label: 'java', value: 'Java' },
        { label: 'perl', value: 'Perl' },
        { label: 'ruby', value: 'Ruby' }
      ];
      
    2. I will assume both comboboxes use the same data.

    With this into account you can use the data parameter to initialize the comboboxes. And, in the onchange event then filter out the matches in the partner combobox set the filtered content using the loadData method.

    $cb1.add($cb2).combobox({
        data: data,
        onChange: function(newValue) {
            var $cb = $cb1.is(this) ? $cb2 : $cb1;
            $cb.combobox("loadData", data.filter(function(e) {
                return e.label !== newValue;
            }));
        }
    });
    

    See it here.


    UPDATE

    An alternative without modifying the HTML layout.

    var $cb1 = $('#combobox1'), $cb2 = $('#combobox2');
    
    $cb1.data("combobox-data", $cb1.combobox("getData"));
    $cb2.data("combobox-data", $cb2.combobox("getData"));
    
    $cb1.add($cb2).combobox({
      onChange: function(newValue) {
        var $cb = $cb1.is(this) ? $cb2 : $cb1;
        var data = $cb.data("combobox-data");
        $cb.combobox("loadData", data.filter(function(e) {
          return e.label !== newValue;
        }));
      }
    });
    

    There you go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have two jquery functions that bassically do the same, but on 2
I have two JavaScript files that contain a jQuery function with the same name
I have two jQuery files that were conflicting with each other. I was getting
I have two list boxes and some JQuery function that does the following: $(document).ready(function
I have two jQuery plugins that use the same function name (bind), can i
I have two Jquery functions that each work independently on a sharepoint page -
Assuming I have the following two JQuery functions - The first, which works: $(#myLink_931).click(function
I have two select lists, I would like jquery to either remove or disable
I have two scripts running on the same page, one is the jQuery.hSlides.js script
So i have these two jquery functions which pass my XHR service a key

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.