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="Scripts/jquery-1.10.2.min.js"></script> 
<script type="text/javascript"> 
$(function () { 
$("input[type='checkbox']").click(function () { 
var lvalue = $(this).val();//获取value值 
// alert(lvalue); 
var lname = $(this).next().text();//获取text值 
var yuanGong = document.getElementById("TextArea1"); 
yuanGong.value = 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="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> 

原文地址:https://www.cnblogs.com/lyl6796910/p/3842961.html