[jQuery] prevAll() Working in Safari 3 but not Firefox (2 or 3pre Beta)
Hello everyone! I've been reading this group's messages for a while
now. Its really helpful and has kept me from having to ask a question.
Until now.
i'm having an issue with some code working in Safari 3 but not in
Firefox 2.0.0.11 and Firefox 3pre Beta (the nightly builds). I have a
file called jsfile.js where i have a good bit of my jQuery code and
another file called htmlfile.html. The jQuery and jsfile files are
linked in the header of htmlfile.html.
The problem i am having is that in Safari 3, the Hide These link in p
class="More" does hide the Stuff div in Safari 3. However in Firefoxes
2 and 3pre it does not.
Following is my HTML:
<td class="StreamBody>
<a class="hidden_toggle" href="#" target="_blank"
onclick="showHiddenActivitiesLists(this); return false;">the link to
display the Stuff div below</a><br />
<div class="Meta">
<div class="time"><a href="some_link" class="secondary">another
link</a>
</div>
</div>
<div class="Stuff" style="display:none">
<ul class="Music">
<li class="hidden_activity">a list item</li>
</ul>
<p class="More"><a href="#" class="secondary" onclick="$
(this).parent().parent().prevAll('a.hidden_toggle').click(); return
false;">Hide These</a>
</div>
</td>
And now for my javascript:
function showHiddenActivitiesLists(el) {
$(el).attr('onclick','hideHiddenActivitiesLists(this); return
false;');
$(el).parents('.StreamBody').children('.StreamStuff').fadeIn(500);
}
function hideHiddenActivitiesLists(el) {
$(el).attr('onclick','showHiddenActivitiesLists(this); return
false;');
$(el).parents('.StreamBody').children('.StreamStuff').fadeOut(500);
}
The Hide These onclick should traverse the DOM to the hidden_toggle
and then call the .click() on that link. It does this in Safari 3,
thus re-hiding the Stuff div. However it seems Firefox 2 and 3pre
ignore it.
Any ideas why it would work in Safari 3 and not Firefox?