[jQuery] Re: Triggering a click

2008-09-05 Thread Paul Thiel

At a glance it looks as though you are targeting the wrong element.
The parent() takes you to the DIV and the next() takes you to the next
DIV (awardnomination).  Just use $(this).prev('img').trigger('click')
or similar.

On Sep 5, 9:06 am, jerpod [EMAIL PROTECTED] wrote:
 I've got some html that looks like this:

 div class=awardheading
   img class=plusminus src=/images/plus.gif Some text here. a
 class=nominatelink href=#Make your nomination./a/div

 div class=awardnomination
         This is award info
 /div

 A click on the plusminus image shows/hides the awardnomination div.
 That's working.  I also want a click on the nominatelink to trigger a
 click on the image...since I've already got that working.

 I thought something like:

 $(this).parent().next('img').trigger('click')

 would work but I get nothing when clicking the link.  Thanks in
 advance!

 jp


[jQuery] Re: Triggering a click

2008-09-05 Thread Ca-Phun Ung

Try:

$('.nominatelink').click(function(e){
  $(this).siblings('img').trigger('click');
  e.preventDefault();
});


[jQuery] Re: Triggering a click

2008-09-05 Thread [EMAIL PROTECTED]

$(this).parent().next('img').click();

then you can insert a function hope that helps...
jereyBass

On Sep 5, 9:06 am, jerpod [EMAIL PROTECTED] wrote:
 I've got some html that looks like this:

 div class=awardheading
   img class=plusminus src=/images/plus.gif Some text here. a
 class=nominatelink href=#Make your nomination./a/div

 div class=awardnomination
         This is award info
 /div

 A click on the plusminus image shows/hides the awardnomination div.
 That's working.  I also want a click on the nominatelink to trigger a
 click on the image...since I've already got that working.

 I thought something like:

 $(this).parent().next('img').trigger('click')

 would work but I get nothing when clicking the link.  Thanks in
 advance!

 jp


[jQuery] Re: Triggering a click

2008-09-05 Thread jerpod

Thanks Ca-Phun Ung...that's exactly what I needed.

jp

On Sep 5, 11:25 am, Ca-Phun Ung [EMAIL PROTECTED] wrote:
 Try:

 $('.nominatelink').click(function(e){
   $(this).siblings('img').trigger('click');
   e.preventDefault();

 });


[jQuery] Re: Triggering a click

2008-09-05 Thread Ca-Phun Ung

jerpod wrote:
 Thanks Ca-Phun Ung...that's exactly what I needed.

   

Cool :)