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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:53:21+00:00 2026-06-11T13:53:21+00:00

In a html page, if I use my mouse to select an item from

  • 0

In a html page, if I use my mouse to select an item from a drop-down list(the select and option html elements), then the onchange event will be fired.
But if I use Javascript to change the selectedindex of a select element, then the onchange event won’t be fired.

How are those two actions different?

How can I trigger the onchange event (not by calling selectElement.onchange() explicitly)?

  • 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-11T13:53:22+00:00Added an answer on June 11, 2026 at 1:53 pm

    See this: http://jsfiddle.net/9xe9b/

    $("#currency").change(function(){
        var val = $(this).val();
    
        $(this).val(formatCurrency(val));
    });
    
    $("#infinite").change(function(){
        var val = $(this).val();
    
        $(this).val(formatCurrency(val));
        $(this).change(); // simulate the change event. 
    });
    
    function formatCurrency(num) {
        num = isNaN(num) || num === '' || num === null ? 0.00 : num;
        return parseFloat(num).toFixed(2);
    }
    

    If you enter a value into the second textbox and pop open your console, you’ll see this error:
    Uncaught RangeError: Maximum call stack size exceeded

    This is what we would have to worry about if changing a value in javascript caused a related event to fire. Infinite loops!

    So, if you need to repeat functionality when changing a value through the UI or through javascript, you should create a function that does what you want and call it in the appropriate instances.

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

Sidebar

Related Questions

I use WebView + addJavascriptInterface to control my app from html page shown in
I'm trying to use WWW::Mechanize to extract some links from the HTML page using
How can I stop user from using mouse wheel to scroll HTML page? Normally
We have a HTML page. Is it possible to select (by mouse) few words
I had the following HTML page rendering to use the Google Maps API. This
I had created one HTML page for my experiance. In this i had use
I am trying to use html5lib to parse an html page in to something
I have an link in HTML and I use Page Object pattern to write
I have a page with some very basic examples that use HTML/CSS/JavaScript. I'd like
Try to download this page: http://www.4shared.com/get/B4AgMkcw/cookies.html I can use wget/firefox to get the whole

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.