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
Post a Comment