ckeditor validation for spaces

前端 未结 1 1558
北恋
北恋 2021-01-16 23:24

How can i implement validation on ckeditor to prevent user from adding spaces only . Any answer within today will be greatly appreciated .

following

相关标签:
1条回答
  • 2021-01-17 00:05

    Since you are evidently using jQuery, you can add jQuery.trim() as an additional check for your condition:

    jQuery.trim(editor_val).length != 0
    

    This will trim all whitespace from the submitted form and check whether there are any characters remaining. If the input consists only of whitespace, the statement will evaluate to false. You would integrate it into the following line:

    if (editor_val != "" && editor_val != "" && jQuery.trim(editor_val).length != 0)
    
    0 讨论(0)
提交回复
热议问题