I thought this would do it but no luck

$(this).parents("checkbox:first").attr('checked', false);


On Sep 28, 2:42 pm, "evanbu...@gmail.com" <evanbu...@gmail.com> wrote:
> Hi
>
> I've been using jQuery a couple of months and I'm really having a
> blast with it but need a little help with this problem.
>
> I have a table of records generated from a database that looks like
> this. Each record has a checkbox with a unique id followed by a
> person's name and employment status.
>
> <tr><td>
>       <input type="checkbox" id="rptDirectors_ctl19_chkDirectorName"
> class="chkDirector" checked="checked" value="25094" />
>       <span id="rptDirectors_ctl19_lblDirFName">J. Pedro</span>  <span
> id="rptDirectors_ctl19_lblDirLName">Reinhard</span> (<span
> id="rptDirectors_ctl19_lblRelStatus" class="RelStatus">Retired</span>)
> </td></tr>
>
> <tr><td>
>       <input type="checkbox" id="rptDirectors_ctl23_chkDirectorName"
> class="chkDirector" checked="checked" value="29632" />
>       <span id="rptDirectors_ctl23_lblDirFName">James B.</span>  <span
> id="rptDirectors_ctl23_lblDirLName">Williams</span> (<span
> id="rptDirectors_ctl23_lblRelStatus" class="RelStatus">Active</
> span>)
> </td></tr>
>
> When this checkbox (chkIncludeRetired) is checked/unchecked, the
> person's employment status (RelStatus) is checked and the entire row
> is hidden/shown. My jquery code below does this perfectly with no
> problems.  However, in addition to hiding/showing the row. However, I
> also need the parent checkbox to be checked or unchecked. So if
> RelStatus == "Retired" then it's parent checkbox also needs to be
> unchecked else then it's parent checkbox needs to be checked.
>
> <input id="chkIncludeRetired" type="checkbox" /><i> Exclude Retired
> Directors and Executives</i>
>
> <script language="javascript" type="text/javascript">
> $(document).ready(function() {
>       $('#chkIncludeRetired').click(
>           function() {
>           $('.RelStatus').each(function() {
>              if ($("#chkIncludeRetired").is(":checked"))
>             {
>                 if ($(this).text() == "Retired")
>                         $(this).parent().css('display',
> 'none');
>             }
>             else
>             {
>                 $(this).parent().css('display',
> 'block');
>             }
>         });
>     });});
>
> </script>
>
> Thank you very much.

Reply via email to