How to set the select value in javascript: 1. Set the select value in native js, the code is [var gd2=document.getElementById("goods_name2")]; 2. Set the select value in jquery.
The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, DELL G3 computer.
How to set the select value in javascript:
1. How to set the select value in native js
(1) Sometimes You may need to hide the select, but you also need to change the value passed by the select. (The default selected value of select is the first one, that is, the option value with subscript 0)
1 2 3 4 5 6 |
|
(2) Native js changes the selected value of select
1 2 3 4 5 6 |
|
1 2 3 |
|
2, How to set select value in jquery
1 2 |
|
Related free learning recommendations: javascript video tutorial
The above is the detailed content of How to set select value in javascript. For more information, please follow other related articles on the PHP Chinese website!