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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:34:42+00:00 2026-06-14T06:34:42+00:00

I have a (multiple) select in my JQM page. I need to force option

  • 0

I have a (multiple) select in my JQM page.

I need to force option with value ‘A’ de-selection on any other option selection.

HTML is like this:

<select name="select-1" id="select-1" multiple="multiple" data-native-menu="false" />
   <option value='A'>a</option>
   <option value='B'>b</option>
   <option value='C'>c</option>
</select>

I’m using some code like this, with no success… 🙁

$("select#select-1").change(function() {
    $("select#select-1").val('A').attr("selected", false).trigger("refresh");
});

It looks like the option I’m trying to de-select is selected, and all others are de-selected (excluded the current one) … 🙁

A jsfiddle is here.

  • 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-14T06:34:43+00:00Added an answer on June 14, 2026 at 6:34 am

    I played around a little bit with your problem and assuming I did not misunderstand your problem (see comments), this snippets works (however probably there are simpler solutions…)

    If option with value=’B’ is selected, then option with value=’A’ will be deselected.

    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>if B selected, deselect A</title>
      <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
      <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
      <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
    </head>
    
    <body>
      <!-- if B selected, deselect A -->
      <div data-role="page">
        <div data-role="content">
          <select name="select-1" id="select-1" multiple="multiple" data-native-menu="false" />
            <option id="option-A" value='A'>a</option>
            <option id="option-B" value='B'>b</option>
            <option id="option-C" value='C'>c</option>
          </select>
        </div><!-- /content -->
      </div><!-- /page -->
    
      <script>
        $("#select-1").change(function() {
          var mySelection = $(this).val();
          if (mySelection !== null) {
            if (mySelection.indexOf('B') >= 0) {
              $("#option-A").attr("selected", false);
              $('#select-1').selectmenu('refresh');
            };
          };
        });
      </script>
    </body>
    </html>
    

    EDIT updated now with $('#select-1').selectmenu('refresh'); and it now also works in the jsfiddle

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

Sidebar

Related Questions

So I have two multiple select boxes like this <select id=foo multiple=multiple> <option value=1>Option
I have a multiple select list defined like this <select id=MyId multiple=multiple> <option value
I have this HTML: <select multiple='multiple' size='3'> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> Using
I have a multiple select, and I need to force the user to choose
i have a multiple select tag <select multiple=multiple size=5 id=cities_select> <option value=1>city1</option> <option value=2>city2</option>
I have multiple dynamically set select boxes on my page (like over 100). I
Let's say that I have a multiple select field like this: <select id=foodlist multiple=multiple>
I have multiple selects: <select id=one> <option value=1>one</option> <option value=2>two</option> <option value=3>three</option> </select> <select
Let's say I have a multiple select box: <select id=sel multiple=multiple> <option value=1>One</option> <option
I have multiple tables that need to be merged into one. SELECT name, SUM(money)

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.