Rick - I think you want $(this).parent().hide() rather than prev, and
$(this).parent().next() rather than next().  Prev and next look at the
sibling level.

-- Josh


-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, January 13, 2009 12:17 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to make this work for multiple elements with same
class


Ok...made that change, but no difference in the execution.

Here's the relevant js and html/cf:

$(document).ready(function() {
                
     $('.update-link').click(function() {
                                                
          $(this).prev('.options').hide();
          $(this).next('.update-div').fadeIn(500);
                                                
     });
});


<div class="options">
     [ <a href="#tour_url#" target="_blank">Preview</a> ] &nbsp;
     [ <a class="update-link" href='##'>Update</a> ] &nbsp;
     [ <a href= "##">Delete</a> ]
</div>
        

<div class="update-div">
        

     <div>Edit Link:</div>
     <div><input class="textinput01 update-input" size="80"
value="#tour_url#"></div>
     <div><input class="update-button" type="button" value="Update"></div>
        

<div>





> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of MorningZ
> Sent: Tuesday, January 13, 2009 3:05 PM
> To: jQuery (English)
> Subject: [jQuery] Re: How to make this work for multiple elements with
same class
> 
> 
> to start: you have
> 
> $('this')
> 
> it should be without the ticks
> 
> $(this)
> 
> On Jan 13, 2:50 pm, "Rick Faircloth" <r...@whitestonemedia.com> wrote:
> > Here's the code that I'm trying to make function
> > for multiple links on a page with the class of "update-link"
> >
> > How would I change this to make it work for the specific
> > .update-link element that I click?
> >
> >                 $(document).ready(function() {
> >
> >                         $('.update-link').click(function() {
> >
> >                                 $('this').prev('.options').hide();
> >                                
$('this').next('.update-div').fadeIn(500);
> >
> >                         });
> >                 });
> >
> > Thanks,
> >
> > Rick

Reply via email to