Well blank() was not created in jQuery.

You can create a new function for jQuery like this.

(function($){
  $.fn.blank = function(){
    return $.trim(this[0]).length == 0;
  }
})(jQuery)

<input id="one" value="sadf" />
<input id="two" value="  " />

$('#one').blank(); // return false
$('#two').blank(); // return true

haven't tested the code but should be pointing you to the right
direction.

Great thing is that jQuery allows you to extend it as you see fit.
On Dec 21, 12:40 am, "Lay András" <lays...@gmail.com> wrote:
> Hello!
>
> Is there any way in jQuery to test if a input value is blank? I mean
> similar like:
>
> if ($F('szoveg').blank()) {
>    ...
>
> }
>
> in prototype. With jQuery now i'm using this:
>
> if ($('#szoveg').val()=='') {
>    ...
>
> }
>
> but this not test if a input contains only whitespaces.
>
> Bye!
>
> Lay

Reply via email to