[jQuery] Re: if ($("#field").val() == '') or something more elegant?

2008-12-07 Thread Richard D. Worth
On Sat, Dec 6, 2008 at 5:26 PM, Yuvraj Mathur <[EMAIL PROTECTED]> wrote: > > Not sure but should be like this: > if($(#'text').val('')); Actually, this would *set* the value to '' and would always evaluate to true, because it returns the jQuery object for chaining (if you don't supply an arg to

[jQuery] Re: if ($("#field").val() == '') or something more elegant?

2008-12-07 Thread Yuvraj Mathur
Not sure but should be like this: if($(#'text').val('')); Try up this and let me know if it works. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Costaud Sent: Sunday, December 07, 2008 3:43 AM To: jQuery (English) Subject: [jQuery] if ($("#fiel

[jQuery] Re: if ($("#field").val() == '') or something more elegant?

2008-12-06 Thread Joe
Karl's suggestion is how I always do it...simplest IMO. On Dec 6, 8:19 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote: > Sure, that's fine. You could also do this: > > if (!$('#text').val()) > > --Karl > > > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Dec 6, 2008, at

[jQuery] Re: if ($("#field").val() == '') or something more elegant?

2008-12-06 Thread Karl Swedberg
Sure, that's fine. You could also do this: if (!$('#text').val()) --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 6, 2008, at 5:12 PM, Costaud wrote: Hello, I'm wondering if this is the correct way of checking whether the textbox is empty or not: i

[jQuery] Re: if ($("#field").val() == '') or something more elegant?

2008-12-06 Thread Erik Beeson
Whoops, that matches "has no children". I think what you did is fine. --Erik On Sat, Dec 6, 2008 at 3:56 PM, Costaud <[EMAIL PROTECTED]> wrote: > > That is always saying the field is empty. > > On Dec 6, 5:24 pm, "Erik Beeson" <[EMAIL PROTECTED]> wrote: > > Maybe try: > > if($('#text').is(':empt

[jQuery] Re: if ($("#field").val() == '') or something more elegant?

2008-12-06 Thread Costaud
That is always saying the field is empty. On Dec 6, 5:24 pm, "Erik Beeson" <[EMAIL PROTECTED]> wrote: > Maybe try: > if($('#text').is(':empty')) > > --Erik > > On Sat, Dec 6, 2008 at 2:12 PM, Costaud <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I'm wondering if this is the correct way of checkin

[jQuery] Re: if ($("#field").val() == '') or something more elegant?

2008-12-06 Thread Erik Beeson
Maybe try: if($('#text').is(':empty')) --Erik On Sat, Dec 6, 2008 at 2:12 PM, Costaud <[EMAIL PROTECTED]> wrote: > > Hello, > > I'm wondering if this is the correct way of checking whether the > textbox is empty or not: > > if ($("#text").val() == '') > > Thanks.