jquery中checkbox的click事件不起作用?
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> <input type="checkbox" name="service" value="1">1
<input type="checkbox" name="service" value="2">2 </td>
</tr>
<tr>
<td> </td>
<td id="ccc"> </td>
</tr>
<tr>
<td> </td>
<td> <input type="checkbox" name="service" value="4">4 </td>
</tr>
</table>
<script language="javascript" src="../js/jquery.js"> </script>
<script language="javascript">
$("input[@name='service']").click(function(){
l=$("input[@name='service']").length;
str="";
k=0
for(i=0;i <l;i++)
{
if($("input[@name='service']")[i].checked==true)
{
if(k==0)
str+=$("input[@name='service']")[i].value;
else
str+=","+$("input[@name='service']")[i].value;
k++;
}
}
alert(str);
});
$("#ccc").html(' <input type="checkbox" name="service" value="3">3');
</script>
我这样写,点击3,为什么不起作用?如何改