I have a view of nodes in drupal. Each node has button which (is supposed to) toggle an extra row in a table. However, although I am able to toggle the extra row open, I am unable to toggle it shut again.
Here is the javascript;
Drupal.behaviors.morelink = function(context) {
$("a.morelink").click(function (e) {
e.preventDefault();
$('.more').hide();
$('.more').eq( $('a.morelink').index( $(this) ) ).toggle();
});
}
Here is the button in my node-type.tpl.php;
<a class="morelink" href = "<?php print url('node/' . $node->nid); ?>">
<img src="greydown.png" ALT="More"></a>
Here is the extra row;
<tr class="more ">
<td> some content here</td>
</tr>
And here is the css;
.more {
display:none;
}
Any ideas as to why I cannot toggle shut (hide it) again?
Probably because you
hidethentoggleevery time, which results in ashow. I.e.:If you remove the
hide(), you should be good.