Sorry, I forgot to mention that this would not work if your class is
like:

<a href="..." class="someclass edit_profile">...</a>

because it checks for class="edit_[something]"

There's another solution to that, but I can't recall what it is on the
top of my head right now.

On Jun 3, 8:32 am, "Dave Maharaj :: WidePixels.com"
<d...@widepixels.com> wrote:
> Perfect...
>
> Thanks for your help.
>
> Greatly appreciated.
>
> Dave
>
> -----Original Message-----
> From: James [mailto:james.gp....@gmail.com]
> Sent: June-03-09 3:55 PM
> To: jQuery (English)
> Subject: [jQuery] Re: Newbie question on selectors
>
> $("a[class^=edit_]").click(...);
>
> This is saying: all <a> with class that begins with 'edit_'.
>
> http://docs.jquery.com/Selectors
>
> On Jun 3, 8:20 am, "Dave Maharaj :: WidePixels.com"
> <d...@widepixels.com> wrote:
> > I have a page with 6 links that each have a unique class ;
> > edit_profile edit_preferences edit_journal edit_entry.... and so on
>
> > now I built 1 function based off edit_profile
> > $("a.edit_profile").click(function(){
> > var url_id = $(this).attr('href');
> > do stuff......
>
> > });
>
> > but rather than writing the same function and changing the selector
> > everytime how can i get this all into 1 function?
>
> > Thanks,
>
> > Dave

Reply via email to