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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:32:44+00:00 2026-05-26T03:32:44+00:00

I have a select dropdown in a html file that i can’t really touch

  • 0

I have a select dropdown in a html file that i can’t really touch

<select id="color" onChange="javascript:changeColor(this)">
<option value="black">Black</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="gold">Gold</option>
</select>

I am trying to manipulate that using prototype js

var update_dropdown=$$('select#color option');
var option_length= update_dropdown.length;
for (var m = 0; m &lt; option_length; m++) {
    if(update_dropdown[m].value==selected_ColorId) {
        update_dropdown[m].selected=true;
    }
}

is there any way that i can call onChange event that is being called in the html , like in this instance changeColor()?I am using prototype js
thanks

  • 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-26T03:32:45+00:00Added an answer on May 26, 2026 at 3:32 am

    You don’t need to call the change event itself. Since the change event is just hooked up to a javascript function of yours, you can just call the changeColor function directly with the appropriate parameters to mimic when the actual event occurs.

    var selectObj = document.getElementById('color');
    changeColor.call(selectObj, selectObj);
    

    This will do that same thing as changeColor(this).

    FYI, in the two arguments to changeColor.call(a, b), the a argument sets the this pointer in the changeColor function to be your select object and the b argument sets the first function argument in the changeColor function to be your select object to match how you have it called in your HTML.

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

Sidebar

Related Questions

I have this HTML dropdown: <form> <input type=text id=realtxt onkeyup=searchSel()> <select id=select name=basic-combo size=1>
if i have a dropdown with the following html: <select id=myDropdown name=myDropdown> <option value=6>Six</option>
i have a time dropdown that shows hour in one select, minutes in another
i have a form that has a multiple select drop down. a user can
To dynamically fill DropDown controls on my HTML Form, I have written code that
Twitter Bootstrap http://twitter.github.com/bootstrap/javascript.html#dropdown has a dropdown.js library (at http://twitter.github.com/bootstrap/1.4.0/bootstrap-dropdown.js )that will change the dropdown
I have the following HTML: <select id=dropdown> <option>A</option> <option>B</option> <option>C</option> </select> I have the
I'd like to have a menu (select box replacement dropdown) that, when clicked, fades
I have an html table and in one column I have dropdown select. I
I have the need to show the DropDown (HTML select element) expanded initially when

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.