when we use the select drop-down list box, we need to select the selected < option> Option triggers an event, in fact < option> There is no event method itself, we only fire in the onChange method in the SELECT.
wants to add an option trigger event, but adding onclick to the option does not trigger the event
add onclick in the select.
solution: u> span> add a change to the select event can span> strong> p>
< select id=”sumyear” >
< option grade=”0″ value=”a” > Please select year & LT; /option>
< option grade=”1″ value=”b” > 2018< /option>
< option grade=”2″ value=”c” > 2019< /option>
< /select>
$(“#sumyear”).change(function(){
alert($(this).children(‘option:selected’).val());
span>})
span> strong> p>
Read More:
- [Solved] VUE3.0 Warning: Added non-passive event listener to a scroll-blocking ‘mousewheel‘ event如何解决
- Click the button to use in the react project window.open Methods open a new page and click the data again
- JQuery: How to get the selected values of checkbox, radio and select
- How to increase the effect of onchange event after adding readonly attribute to input tag and display time of laydate plug-in
- After JQ gets the tag element itself, it gets its own HTML text format (find only finds one level of child elements)
- Resolve the problem of “event ID 4107” or “event ID 11” errors recorded in the application logs of windows and windows server
- Error reporting under layui dynamic select IE
- Uncaught Error: Call to undefined function mysql_select_db()
- The SSM framework adds the mybatis paging plug-in to start the error report
- [turn] right click to open the prompt [shellexecute failed (2): is this command correct? (fix)] with Notepad + +
- mysql workbench Error Code: 1046. No database selected Select the default DB to be used
- Click the button to jump to a new window
- Clion automatically adds add_ executable
- After BS4, select was used to locate
- Numpy adds a new dimension: newaxis
- MacOS adds code command to vs Code
- How to make eclipse after the program is modified, click run to automatically save it.
- Uiautomatiorviewer connect to the machine and click to report unexpected error while observing UI hierarchy
- ABAP edit screen click layout to dump
- Office 16 Click to run extensibility component uninstall