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
> 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/
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 straightfo
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");
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 bett
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
> > whateve
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 eith
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
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 'pr