Hi Paul,

Try this:

$('form :input').each(function() {
        var thisInput = $(this);
        var trimmedVal = $.trim($thisInput.val());
        $thisInput.val(trimmedVal);
});


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 23, 2008, at 11:25 PM, PaulM wrote:


I would like to go through all inputs in a form and trim the fields in
them.
How do I do this with the $.each function?

I looked at the documentation and its not clear. Please give me code.

Reply via email to