[英]How to trigger select change event from custom placeholder
I have custom placeholder above select control.我在 select 控件上方有自定义占位符。 but the click event is not triggering when I click the custom placeholder, please suggest the best way to achive the select event, with out using jquery.但是当我单击自定义占位符时单击事件未触发,请建议在不使用 jquery 的情况下实现 select 事件的最佳方法。
Please check the code请检查代码
<div id='placeholder' style='font-size:10px; dispaly:none;background-color:red;position:absolute;left:10px'> Options </div> <select id='selectcontrol' style='background-color:yellow; height:40px'> <option>Option A</option> <option>Option B</option> <option>Option C</option> </select>
select
and placeholder div
with another div.您可以用另一个 div 包装您的select
和placeholder div
div。select
's background transparent使select
的背景透明placeholder div
is below the select
using position:absolute
for both of the elements确保您的placeholder div
低于select
使用position:absolute
对于这两个元素 <div style="background-color:yellow;height:40px;width:100px"> <div id='placeholder' style='font-size:10px;background-color:red;position:absolute;left:10px'> Options </div> <select id='selectcontrol' style='background-color:transparent; height:inherit;width:inherit;position:absolute;'> <option>Option A</option> <option>Option B</option> <option>Option C</option> </select> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.