The question is simple, i want to trim an input text (with id title)and a textarea (with id description), how can i do? I only know how todo to the title id, but not both:

if (!$.trim($("#title)".val()))
有帮助吗?

解决方案

Something like this if both have to be empty

if ( !$.trim($("#title").val()) && !$.trim($("#description").val()) )

If just one empty is wrong, use

if ( !$.trim($("#title").val()) || !$.trim($("#description").val()) )
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top