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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:44:43+00:00 2026-05-13T19:44:43+00:00

HTML <select multiple=multiple id=myID name=myName> <option value=blue>blue</option> <option value=red>red</option> <option value=green>green</option> </select> jQuery: $(‘select’)

  • 0

HTML

<select multiple="multiple" id="myID" name="myName">
    <option value="blue">blue</option>
    <option value="red">red</option>
    <option value="green">green</option>                
</select>

jQuery:

$('select')
    .change(function(){
        alert("Change Event Triggered On:" + $(this).attr("value"));
    })

That, as is, works. If I click an item in the multiselect, the alert is triggered.

However, when I ‘select’ an element from the select menu via jQuery like so:

$('#myOtherSelector')
    .click(function(){
        var $matchingOption = [goes and selects the specific OPTION to toggle]
        if ($matchingOption.attr("selected")){
            $matchingOption.removeAttr("selected")
        }else{
    $matchingOption.attr("selected","selected");
        }
    })

That script works in that it changes the SELECTED attribute and visually updates the option list, however the onchange event doesn’t get triggered in that scenario.

Why is that?

  • 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-13T19:44:43+00:00Added an answer on May 13, 2026 at 7:44 pm

    Changing elements with code like that just doesn’t trigger event handlers. You can do it yourself however:

    else {
      $matchingOption.attr('selected', 'selected').trigger('change');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my HTML <select name=countries id=countries MULTIPLE size=8> <option value=UK>UK</option> <option value=US>US</option> <option
I have a classic HTML select box: Show: <select name=show id=showThreads> <option value=all selected=selected>All</option>
Given the following HTML: <select multiple> <option value=1 selected>One</option> <option value=2 selected>Two</option> <option value=3>Three</option>
How do you preselect an option in a multiple select html tag using jquery's
I have a multiselect in html file like this: <select multiple id=mymultiselect name=mymultiselect> <option
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 HTML select list, which can have multiple selects: <select id=mySelect name=myList
I have this piece of HTML <select multiple= name=colonia_id[] id=colonia_id[] onchange= size=10></select> I need
Trying IE Automation with Powershell. Task: Select multiple option value fields and click submitbutton.
I have this: <select id=combo1 size=7 name=operacion> <option selected= value=000>Selecciona una categoría</option> <option value=1>AUTORIZACIÓN

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.