<button name="游泳" class="id" >游泳</button><button name="跳远" class="id" >跳远</button> <asp:TextBox type="hidden" ID="j_type" runat="server" ></asp:TextBox>要实现的功能是点击其中一个button将获取的值赋值给 j_type , j_type string类型
空的,没有获取
$(".id").click(function(){ $("#j_type").val($(this).attr("name"));}) 看错了 你是放在了name属性里面的