Hmm - your code isn't doing what you think it is, try this:

function openDetailClick() {
               $('a.detail_show').click(function() {
                       var next = $(this).parent().parent().next()
                       if( next.is(":hidden") ) {
                               $(this).text('Close detail'); // change
the link text
                               next.show();
                       } else {
                               $(this).text('View detail'); // change
link text back
                               next.hide(); //hide
                       }
                       return false;
               });
}

--John



On Fri, Oct 3, 2008 at 1:42 PM, clrockwell <[EMAIL PROTECTED]> wrote:
>
> This is driving me crazy, and is probably just a ridiculous error on
> my part.
>
> I have a link that takes the visitor to a 'detail' page.  I want to
> use jquery to have that detail link toggle a table display instead of
> taking them to another page (if they have javascript enabled).
>
> I have it working to open, but it does not close.  I think I just need
> to re-bind the click handler, but hopefully someone with more
> experience can tell me this.  My code is:
> function openDetailClick() {
>                $('a.detail_show').click(function(event) {
>                        if( ($(this).parent().parent().next().css('display', 
> 'none')) ) { //
> display is none so we need to show
>                                $(this).text('Close detail'); // change the 
> link text
>                                $(this).parent().parent().next().show(); //
>                        }
>                        else 
> if(($(this).parent().parent().next().css('display', '')) ) { //
> currently being shown
>                                $(this).text('View detail'); // change link 
> text back
>                                
> $(this).parent().parent().next().css('display', 'hide'); //hide
>                        }
>                        event.preventDefault();
>                });
>
>        }
>
> The abbreviated html structure is:
> <table cellpadding="0" cellspacing="0" border="0">
>                <tr class="reg_summary">        <td>[detail link 
> here]</td></tr>
>                <tr class="reg_list_detail" style="display: none">
>                        <td>
>                                <table>
>                                <tr><td>Address: </td><td>Address'</td></tr>
>                                </table>
>                                <div id="action_nav"></div>
>                        </td>
>                </tr>
> </table>
>
> Thanks much for any help
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to