'refresh' click event
'refresh' click event
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