复选框在jquery中单击事件

时间:2014-02-07 00:33:58

标签: jquery

我的div里面有多个复选框,我有复选框点击事件的功能 但我的问题是它只适用于第一次点击事件然后它不起作用。 我的代码在下面

$(document).ready(function () {
        var oldCaseStatus = $("#ctl00_MainContent_ddlCaseStatus option:selected").val();
        $("#divNeedsContent input[type=checkbox]").click(function () {
            alert("hello");

        });
    });

和HTML看起来像

    <div id="divNeedsContent" class="cmIndContent" style="height: auto; display: block;">
<br>

<div id="ctl00_MainContent_UpdatePanel3">

<div id="ctl00_MainContent_gvNeeds" class="AspNet-GridView">

<table cellspacing="0" cellpadding="0" summary="">

<thead>

<tbody>

<tr class="AspNet-GridView-Edit" onmouseout="this.className='AspNet-GridView-Edit'" onmouseover="this.className='gridViewHoover';">

<td>
<input id="ctl00_MainContent_gvNeeds_ctl02_chkAssociatedNeeds" type="checkbox" onclick="GridViewRowSelect(this);setTimeout('__doPostBack(\'ctl00$MainContent$gvNeeds$ctl02$chkAssociatedNeeds\',\'\')', 0)" name="ctl00$MainContent$gvNeeds$ctl02$chkAssociatedNeeds">
</td>
<td>Proof of Age</td>

<td>
<input id="ctl00_MainContent_gvNeeds_ctl02_chkReceivedNeeds" type="checkbox" name="ctl00$MainContent$gvNeeds$ctl02$chkReceivedNeeds">
</td>
</tr>

0 个答案:

没有答案