I have the following jQuery code:
$(myObj).val( $.trim($(myObj).val()) );
From my experience with jQuery and it’s elegant approach to common scripting tasks I feel like jQuery should provide a more elegant way to trim an objects value data. Is there a more elegant way in which the object is not called twice?
See this example from the jQuery
valdocs.