javascript - JQ and Js how to Validate content null (Spacebar) -


my js here:

  $('input[type=submit]').click(function () {     var val = $('#message_content').sceditor('instance').val();       if( val == "" || !val  ) {             alert('content cannot null');     return false;     }     return true;   }); 

i have 1 question:

how validate? if content " "(spacebar) or "   "(full code spacebar)...judgment content null?

 $('input[type=submit]').click(function () {     var val = $.trim($('#message_content').sceditor('instance').val());       if(!val) {             alert('content cannot null');             return false;     }     return true;   }); 


you can try this.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -