No value is required for the automatic value of the javascript drop-down list.

Source: Internet
Author: User

No value is required for the automatic value of the javascript drop-down list.

                                    <select id="applyType" name="$!{status.expression}" class="inp" onchange="receiptAddApplyType()" style="width:150px;">                                                            #foreach($item in ${applyTypes})                                            <option value="$!{item.value}"  #if($!{item.value} == $!{status.value} ) selected #end >$!{item.name}</option>                                        #end                                    </select>



function receiptAddApplyType(){var s=document.getElementById('applyType');alert(s[s.selectedIndex].text);}

No explanation, reliable and easy to use. Try it on your own.


How to obtain the value of the drop-down list using javascript?

Yes
For example, your down list box id is adds
Document. getElementById ("adds"). value is his value.

In fact, the drop-down box can be viewed as a text box, but by selecting a value,
There are more than one drop-down, which is eventually a value.

Note: This option is selected in the drop-down list.

The value Attribute of the select object in the javascript drop-down list. What is the return value?

Select itself does not have a value. When it is used to pass a parameter, the selected option is passed, that is, the value of the option of seleted = seleted, you can also get the above results through a simple test. Give it a try.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.