About 837,000 results
Open links in new tab
  1. javascript - call the function in select option - Stack Overflow

    May 3, 2017 · You should bind mouseup event handler for the select element. The mouseup event is sent to an element when the mouse pointer is over the element, and the mouse button …

  2. Execute Javascript function from html select - Stack Overflow

    Use an onchange event on the select <select onchange="scheduleA.call(this, event)"> Then in your handler... function scheduleA(event) { alert(this.options[this.selectedIndex].text); } DEMO: …

  3. HTML/JavaScript: calling a function with drop-down options?

    Apr 28, 2017 · I'm trying to figure out the correct syntax for calling a Javascript function when a certain option is selected in an HTML drop-down menu. This is the HTML segment of my …

  4. JavaScript select Element - JavaScript Tutorial

    To select a <select> element, you use the DOM API like getElementById() or querySelector(). The following example illustrates how to get the index of the selected option: const sb = …

  5. HTML DOM Select options Collection - W3Schools

    Choose an option in the drop-down list and output the text of the selected option in an element with id="demo": var x = document.getElementById("mySelect"); var i = x.selectedIndex;

  6. Javascript to call function from selected option - SitePoint

    Feb 3, 2005 · So, to get the option that is selected you do this: <select onchange=“something (this)”> where ‘this’ refers to the <select> element. Then, inside the function: if (this.options...

  7. JavaScript Select Option - Tpoint Tech

    Mar 17, 2025 · A function could be described for returning the reference to a selected option or the value. The below gives the reference to a selected option: function getSelectedOption(sel) …

  8. Change “SelectOption Using JavaScript [With Examples]

    Feb 8, 2024 · Let’s see 6 different ways of changing the selected option using JavaScript: 1. Change Select Option by Value. To change the selected option programmatically by the value …

  9. Running javascript function when option selected - Stack Overflow

    Aug 7, 2018 · you can use onchange event to refer your function on selection like <Select id="Selector" onchange="myFunction()"> function myFunction() { var x = …

  10. Get the Value/Text of Select or Dropdown on Change using JS

    Mar 5, 2024 · To get the value and text of a select element on change: Add a change event listener to the select element. Use the value property to get the value of the element, e.g. …

  11. Some results have been removed
Refresh