如何传递参数onChange的html select [英] How to pass parameters on onChange of html select

查看:223
本文介绍了如何传递参数onChange的html select的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是JavaScript和jQuery的新手。我想显示一个组合框-A,它是一个HTML < select> 及其选定的 id onChange()的另一个地方。

I am a novice at JavaScript and jQuery. I want to show one combobox-A, which is an HTML <select> with its selected id and contents at the other place on onChange().

如何使用其选择 id 传递完整的组合框,以及如何传递其他参数onChange事件?

How can I pass the complete combobox with its select id, and how can I pass other parameters on fire of the onChange event?

推荐答案

function getComboA(sel) {
    var value = sel.value;  
}



<select id="comboA" onchange="getComboA(this)">
<option value="">Select combo</option>
<option value="Value1">Text1</option>
<option value="Value2">Text2</option>
<option value="Value3">Text3</option>
</select>

上述示例获取了OnChange 活动。

这篇关于如何传递参数onChange的html select的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆