Robert Granlund
asked on
jQuery Swap Images
I recently made a post for swapping images. The answer was great. However, I have a similar question;
I need to swap a plus sign and a minus sign where there is a view more link. The link toggles open and close a section:
The Menu is not hard coded, it is in a CMS so I can't hard code it and the menu choice (without a link) , has to have a title
I need to swap a plus sign and a minus sign where there is a view more link. The link toggles open and close a section:
<script>
<script>
$(function() {
$('.viewmore').click(function(e) {
e.preventDefault();
$(this).closest('ul').find('.sublinks').toggleClass('noshow');
var text = ($(this).text() == 'View All') ? '-' : '+';
$(this).html(text);
});
});
</script>
</script>
<html>
<ul class="nav">
<li><a href="#" class="viewmore"> View All</a>
<ul style="display: none" class="nav">
<li><a href="#">Option 1</a></li>
<li><a href="#">Option 2</a></li>
<li><a href="#">Option 3</a></li>
</ul>
</li>
</ul>
</html>
I want to remove the "View All" and replace with a + (Plus Sign) and toggle back and forth between a plus and minus sign.The Menu is not hard coded, it is in a CMS so I can't hard code it and the menu choice (without a link) , has to have a title
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.