Hi folks, Really hoping to get this finished up, and sadly I don't have enough experience to do these last steps. I have a long unordered list that will toggle closed with a button push and show only certain elements of the list. That is working great, but the problem is that I need to only show text within a span in that list. I saw a tutorial online yesterday that was doing something like this: $("#bio li:not(.remain>span)").toggle("slow");
but that doesn't work-I think I'm doing it wrong. What I have so far is this:
$(function() {
$("#toggle_bio").click(function() {
$(this).toggleClass("collapsed");
$("#bio li:not(.remain)").toggle("slow");
return false;
});
});
<ul id="bio">
<li>Long bio text.</li>
<li class="remain">text will remain.</li>
<li>Long bio text.</li>
<li class="remain">text will remain.</li>
<li>Long bio text.</li>
<li>Long bio text.</li>
</ul>
<a id="toggle_bio" href="#">Toggle bio</a>
Now this works great, but I need to accomplish two more things:
1) I need to have only the text inside a span remain within the .remain list:
<li class="remain">This text will go away <span>But this text will stay</span></li>
And, I need to change this toggle button to be two buttons:
<a id="toggle_bio" href="#">Toggle bio</a>
into something like:
<a id="longBio" href="#">Long Bio</a><a id="shortBio" href="#">Short Bio</a>
I'm still really new to javascript, so please keep that in mind when you answer. If possible, I don't want to have to change the whole logic of the solution I have-rather modify one or two elements to make this work. Thank you!