[jQuery] Re: Performing a function if an element is present

2007-11-04 Thread Ezra B. Gildesgame
Thanks very much for your help! I ended up using each(). Now to configure Google Groups so that I get email updates about my posts here... Best, Ezra Gildesgame On Nov 2, 1:52 pm, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Ezra, This is the perfect place for such questions. You can

[jQuery] Re: Performing a function if an element is present

2007-11-02 Thread Karl Swedberg
Hi Ezra, This is the perfect place for such questions. You can test for the existence of an element like this (for example): if ( $('#someid').length ) { // do your thing ... } --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Nov 2, 2007, at 1:50

[jQuery] Re: Performing a function if an element is present

2007-11-02 Thread Josh Nathanson
Also, keep in mind that in many cases, you do not need to check for the existence of something as you might if you were using straight up JS. If you try to run a jQuery method on an empty jQuery object, it will not error. For example: $(#mydiv).show(); If #mydiv is not found, the jQuery