Question

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()))
Était-ce utile?

La solution

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()) )
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top