troubleshooting Question

Help targeting an image within an anchor in jquery

Avatar of amydot
amydotFlag for United States of America asked on
JavaScriptScripting LanguagesjQuery
2 Comments1 Solution386 ViewsLast Modified:
For some reason I have issues figuring out jQuery selectors sometimes and was wondering if someone could help me with this simple problem.

I want to do a very simple image switch from a plus to a minus sign when the link is clicked and the row below is revealed. It's always going to be the image within the link that gets changed out. Here's my code:

			$('.expand').click(function() {
			  if( $(this).parents("tr").next("tr").hasClass('hidden')) { 
			  }	else { 
			  return false;
		<table cellspacing="0" cellpadding="4" border="0" width="630">
			<tr valign="top">
				<td width="10"><input type="radio" value="262" name="powervac"></td>
				<td><a class="expand" href="#">Model 12F - Triple Bag<img border="0" align="absbottom" name="Model12F-TripleBag" src="images/plus.gif"></a></td> 
				<td align="right"><span class="add_to"><i>add&nbsp;$1,853.00</i></span></td>
			<tr class="hidden" id="Model 12F - Triple Bag">
				<td colspan="3">
					<table cellspacing="0" cellpadding="1" border="0" width="100%">
					<tr valign="top" rel="">
						<td><input type="checkbox" checked="" value="262-503587" name="vacoptions[]"></td>
						<td width="180"><b><span style="font-size: 10px;">Mount Kits</span></b></td>
						<td><span style="font-size: 10px;">Triple Bags Model 12F Mount Kit for 700 Series </span></td><td align="right" width="30"><span style="color: rgb(51, 102, 153); font-size: 10px;"><i>$170</i></span></td></tr><tr valign="top" rel=""><td><input type="checkbox" checked="" value="262-503193" name="vacoptions[]"></td><td width="180"><b><span style="font-size: 10px;">Collectors</span></b></td><td><span style="font-size: 10px;">Model 12F Triple Bag Assembly, without mount </span></td><td align="right" width="30"><span style="color: rgb(51, 102, 153); font-size: 10px;"><i>$770</i></span></td></tr><tr valign="top" rel=""><td><input type="checkbox" checked="" value="262-503174" name="vacoptions[]"></td><td width="180"><b><span style="font-size: 10px;">Vac Assembly Kits</span></b></td><td><span style="font-size: 10px;">For 3472 Decks, Vac Assembly Drive 372 </span></td><td align="right" width="30"><span style="color: rgb(51, 102, 153); font-size: 10px;"><i>$885</i></span></td></tr><tr valign="top" rel=""><td><input type="checkbox" checked="" value="262-604327" name="vacoptions[]"></td><td width="180"><b><span style="font-size: 10px;">Misc. Vac System Components</span></b></td><td><span style="font-size: 10px;">Exhaust Deflector Kit for 700 Series Kohler engine models with all cloth-bag collection systems </span></td><td align="right" width="30"><span style="color: rgb(51, 102, 153); font-size: 10px;"><i>$28</i></span></td></tr></tbody></table></td></tr><tr valign="top" rel=""><td width="10"><input type="radio" value="265" name="powervac"></td><td><a class="expand" href="#">Model 15 - Lever - Actuator<img border="0" align="absbottom" name="Model15-Lever-Actuator" src="images/plus.gif"></a></td><td align="right"><span class="add_to"><i>add&nbsp;$2,044.00</i></span></td></tr>
					<tr class="hidden" id="Model 15 - Lever - Actuator">
						<td colspan="3">
							<table cellspacing="0" cellpadding="1" border="0" width="100%">
								<tr valign="top"><td><input type="checkbox" checked value="265-503581" name="vacoptions[]"></td><td width="180">Mount Kits</td><td>Model 15 Mount Kit for 700 &amp; 900 Series</td><td align="right" width="30"><i>$105</i></td></tr>
								<tr valign="top" rel=""><td><input type="checkbox" checked value="265-503216" name="vacoptions[]"></td><td width="180">Collectors</td><td>Model 15 Lever-Actuated Hopper, without mount, for 620T, 700 &amp; 900 Series</td><td align="right" width="30">$965</td></tr>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros