jQuery provides a trim method already and you can use it like this:
var myString = " test "; var myNewString = $.trim(myString); myNewString now holds: "test" Here are the docs for the method. http://docs.jquery.com/JavaScript#.24.trim.28_str_.29 -- Brandon Aaron On 4/12/07, Olaf Bosch <[EMAIL PROTECTED]> wrote:
spinnach schrieb: > > you could try something like this (since filter accepts a function): > > $('#content [EMAIL PROTECTED]').filter( > function(index){ > return (this.alt && this.alt.length > 0); > } > ).each(... i have now this: // Removes leading whitespaces function trim( value ) { var re = /\s*((\S+\s*)*)/; return value.replace(re, "$1"); }; $(function(){ $('#content [EMAIL PROTECTED]') .each(function(){ if ( trim(this.alt) != '' ){ Work for me correct, also works on at ALT=" " Thank you -- Viele Grüße, Olaf ------------------------------- [EMAIL PROTECTED] http://olaf-bosch.de www.akitafreund.de -------------------------------