如何在选择的原型javascript选择框中触发onchange事件? [英] how to fire onchange event in chosen prototype javascript select box?
本文介绍了如何在选择的原型javascript选择框中触发onchange事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用所选原型进行选择框。现在我想在该选择框上触发onchange事件。
这里是选择原型的链接
I am using chosen prototype for select box. Now i want to fire onchange event on that select box. here is the link for chosen prototype
如何做到这一点。请帮我。
How to do this. please help me.
<script type="text/javascript" src="/js/Event.simulate.js"></script>
<script src="/js/prototype.js" type="text/javascript"></script>
<script src="/chosen/chosen.proto.js" type="text/javascript"></script>
<div class="side-by-side clearfix" style="margin-bottom:14px;">
<select data-placeholder="Select Loacation" class="chzn-select" tabindex="2" name="source">
<option value="">Select Loacation</option>
<option value="">option1</option>
<option value="">option2</option>
</select>
</div>
Event.observe($(".chzn-select"),'change', function(){
//alert($(".chzn-select").chosen());
})
推荐答案
在选择框对象上使用addEventListener方法。
use the "addEventListener" method on the select box object.
编辑 - 这是一个例子:
EDIT - here's an example:
document.getElementById('selecboxid').addEventListener('change', SomeFunction(), false);
这篇关于如何在选择的原型javascript选择框中触发onchange事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文