[jQuery] Re: Basic help with selectors

2009-10-27 Thread Charlie
if your ID's are only numbered for the sake of trying to match your link to toggle_effect is worth learning about indexing which is extremely useful for 1:1 matching. The allows you to apply class instead of ID to elements assume changing ID's to classes named toggle-effect_button and toggle_

[jQuery] Re: Basic help with selectors

2009-10-27 Thread Rick Faircloth
Gotcha... -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Tuesday, October 27, 2009 12:31 PM To: jQuery (English) Subject: [jQuery] Re: Basic help with selectors On Oct 27, 12:16 pm, "Rick Faircloth" wr

[jQuery] Re: Basic help with selectors

2009-10-27 Thread Simon Morris
On Tue, 2009-10-27 at 09:11 -0700, MorningZ wrote: > $("a[id=^='toggle_effect_button']").click(function() { > var id = this.id.replace("toggle_effect_button", ""); > $("#toggle_effect" + id).toggle('blind',500); > return false; > }); Thanks MorningZ, A small correction is

[jQuery] Re: Basic help with selectors

2009-10-27 Thread MorningZ
On Oct 27, 12:16 pm, "Rick Faircloth" wrote: > How about using a class instead of ID's? > > $('a.toggle_effect_button').click(function() { > >         $(this).toggle('blind',500); > >         return false; > > }); That would hide the itself (which is not what his repetitive code does)

[jQuery] Re: Basic help with selectors

2009-10-27 Thread Michel Belleville
Indeed it seems very repetitive as much as clunky. Though without a glimpse of html I guess I can't do much for you, especially since your code currently uses ids to locate things which doesn't help one bit understanding the underlying dom structure... So, let's assume your html looks something l

[jQuery] Re: Basic help with selectors

2009-10-27 Thread Rick Faircloth
Of MorningZ Sent: Tuesday, October 27, 2009 12:11 PM To: jQuery (English) Subject: [jQuery] Re: Basic help with selectors $("a[id=^='toggle_effect_button']").click(function() { var id = this.id.replace("toggle_effect_button", ""); $("#toggle_e

[jQuery] Re: Basic help with selectors

2009-10-27 Thread MorningZ
$("a[id=^='toggle_effect_button']").click(function() { var id = this.id.replace("toggle_effect_button", ""); $("#toggle_effect" + id).toggle('blind',500); return false; }); On Oct 27, 12:06 pm, Simon Morris wrote: > Hello, > > I'm new to jQuery and would appreciate some h