admin管理员组文章数量:1403438
I have a checkboxlist control in one of the web application. I want to use javascript to handle the SelectedIndexChanged event.
The checkbox list is like
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem>One</asp:ListItem>
<asp:ListItem>Two</asp:ListItem>
<asp:ListItem>Three</asp:ListItem>
<asp:ListItem>Four</asp:ListItem>
<asp:ListItem>Five</asp:ListItem>
</asp:CheckBoxList>
How can I get the SelectedIndexChanged event using javascript?
I have a checkboxlist control in one of the web application. I want to use javascript to handle the SelectedIndexChanged event.
The checkbox list is like
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem>One</asp:ListItem>
<asp:ListItem>Two</asp:ListItem>
<asp:ListItem>Three</asp:ListItem>
<asp:ListItem>Four</asp:ListItem>
<asp:ListItem>Five</asp:ListItem>
</asp:CheckBoxList>
How can I get the SelectedIndexChanged event using javascript?
Share Improve this question edited Mar 20, 2012 at 3:42 Joseph 120k30 gold badges184 silver badges237 bronze badges asked Mar 20, 2012 at 3:40 MithunRajMithunRaj 1034 silver badges12 bronze badges2 Answers
Reset to default 5On server side.. put the follwoing..
CheckBoxList1.Attributes.Add("onclick", "ChangeCheckBox();");
In client side JavaScript section, implement the following function
function ChangeCheckBox() {}
you can use below code
document.getElementById('CheckBoxList1').onchange = function () {
var input = document.getElementById('CheckBoxList1').getElementsByTagName("input")
for (var i = 0; i < input.length; i++) {
if (input[i].type == "checkbox") {
if (input[i].checked == true) {
alert(input[i].value);//Get all the checked checkboxes
}
}
}
}
本文标签: Getting SelectedIndexChanged event of checkboxlist using javascriptStack Overflow
版权声明:本文标题:Getting SelectedIndexChanged event of checkboxlist using javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744414745a2605136.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论