简体   繁体   English

如何获取值选择名称

[英]How can I get the value select name

I´m now beginning with programming and I need to know what text would be the value of this code. 我现在开始编程,我需要知道什么文本将是此代码的价值。 The JS code would be an "on click" event from this unfoldable list. JS代码将是此展开列表中的“单击时”事件。 Thanks you in advance!! 预先谢谢你!

 <select name="select1" data-dojo-type="dijit/form/Select">
        <option value="Artesania">Artesania</option>
        <option value="Banco" selected="selected">Banco</option>
        <option value="Bar">Bar</option>
        <option value="Bodega">Bodega</option>
        <option value="Boutique">Boutique</option>
        <option value="Discoteca">Discoteca</option>

 var selectbox = document.getElementById('select'); selectbox.addEventListener('change', function(){ console.log(this.value); //do whatever you want with the value }); 
 <select name="select1" data-dojo-type="dijit/form/Select" id='select'> <option value="Artesania">Artesania</option> <option value="Banco" selected="selected">Banco</option> <option value="Bar">Bar</option> <option value="Bodega">Bodega</option> <option value="Boutique">Boutique</option> <option value="Discoteca">Discoteca</option> </select> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM