Home > Web Front-end > JS Tutorial > js gets the value and text value in the drop-down list box

js gets the value and text value in the drop-down list box

WBOY
Release: 2016-05-16 17:04:23
Original
1545 people have browsed it

In the programming process, we often get the value in the option when we get the value of the drop-down list box, but there are also times when we need to get the value displayed on the page, for example, we want to get ? The method is very simple, the specific code is as follows:

Copy the code The code is as follows:



function isSelect(selectPress) {
                                                                                                                                                                                                       . Marked 0, 1, 2
var selectValue2 = selectPress.options[selectPress.selectedIndex].innerText; //Display the specific content of the displayed value (Shanghai, Beijing)
/alert(selectValue2);
          if (selectValue == "-1") {
                                                                                                                                               🎜> else {
                                                                                   document.getElementById('form1')                                                                                                                                                                                                  .

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template