سؤال

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