首页 > 代码库 > ASP.NET绑定CHECKBOXLIST--------JQUERY绑定CLICK事件,获取CHECKBOX的VALUE和显示值
ASP.NET绑定CHECKBOXLIST--------JQUERY绑定CLICK事件,获取CHECKBOX的VALUE和显示值
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="http://www.mamicode.com/Scripts/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(function () {
$("input[type=‘checkbox‘]").click(function () {
var lvalue = http://www.mamicode.com/$(this).val();//获取value值
// alert(lvalue);
var lname = $(this).next().text();//获取text值
var yuanGong = document.getElementById("TextArea1");
yuanGong.value = http://www.mamicode.com/yuanGong.value + lname;
}
);
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<textarea id="TextArea1" cols="60" rows="6"></textarea>
<br />
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem Value="http://www.mamicode.com/sddsds">2</asp:ListItem>
<asp:ListItem>1221</asp:ListItem>
<asp:ListItem>4343</asp:ListItem>
<asp:ListItem>4343</asp:ListItem>
<asp:ListItem>gg</asp:ListItem>
<asp:ListItem>gfgfgf</asp:ListItem>
</asp:CheckBoxList>
</div>
</form>
</body>
</html>