Re: [jQuery] Beginner question re: getting and setting element class name

2007-01-14 Thread Miles Storey
I can pass 'this' but using (#+this.id) was the way to do it with the least code written. Inside the function I need to check the first 4 letters of the ID string of the calling element to determine how to proceed, as well as use the id as an element reference for the jQuery object. So it's

Re: [jQuery] Beginner question re: getting and setting element class name

2007-01-14 Thread Ⓙⓐⓚⓔ
Just a bit clunky. To me clunky is a overly long calling sequence this or this.id is easy to pass. #+this.id is more clunky when you put the more clunky expressions inside a function you can re-used 'proven' code. Just the advice from an seasoned(salty) programmer! the less you type in

Re: [jQuery] Beginner question re: getting and setting element class name

2007-01-14 Thread Miles Storey
Thanks, and I already took your advice :) On 1/14/07, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Just a bit clunky. To me clunky is a overly long calling sequence this or this.id is easy to pass. #+this.id is more clunky when you put the more clunky expressions inside a function you can re-used

[jQuery] Beginner question re: getting and setting element class name

2007-01-13 Thread Miles Storey
Hi, I'm just starting to use jQuery and, while I'm not much of a coder, I love the way it works. I was developing a project using the Prototype library, but after discovering jQuery I'm converting everything. I'm finding it straightforward but I have a request for a clarification on something. I

Re: [jQuery] Beginner question re: getting and setting element class name

2007-01-13 Thread Mike Alsup
function checkState(id) { if ($(id).className == something) { etc Use the is method: $(id).is(something); ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/

Re: [jQuery] Beginner question re: getting and setting element class name

2007-01-13 Thread Karl Swedberg
On Jan 13, 2007, at 9:52 PM, Miles Storey wrote: Hi, I'm just starting to use jQuery and, while I'm not much of a coder, I love the way it works. I was developing a project using the Prototype library, but after discovering jQuery I'm converting everything. I'm finding it

Re: [jQuery] Beginner question re: getting and setting element class name

2007-01-13 Thread Miles Storey
Thanks! I didn't know that existed, I assume it returns boolean. That's great! Cheers On 1/14/07, Mike Alsup [EMAIL PROTECTED] wrote: function checkState(id) { if ($(id).className == something) { etc Use the is method: $(id).is(something);

Re: [jQuery] Beginner question re: getting and setting element class name

2007-01-13 Thread Miles Storey
On 1/14/07, Karl Swedberg [EMAIL PROTECTED] wrote: Is id an ID? If so, you could use $('#id.something') and chain whatever methods you want onto it. The code that sets the event and function call is: $(#options).find(a).click(function(){checkState(#+this.id)}); If there's a better way to

Re: [jQuery] Beginner question re: getting and setting element class name

2007-01-13 Thread Ⓙⓐⓚⓔ
a bit clunky! just pass in this! and let checkState do the dirty work... if it is actually needed! On 1/13/07, Miles Storey [EMAIL PROTECTED] wrote: On 1/14/07, Karl Swedberg [EMAIL PROTECTED] wrote: Is id an ID? If so, you could use $('#id.something') and chain whatever methods you