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_
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
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
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)
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
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
$("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
7 matches
Mail list logo