JavaScript中(字符空间字符)或(空格字符空格)的表达式是什么

what is the expression for (character spaces character) or(spaces character spaces) in javascript

本文关键字:字符 空格 表达式 是什么 空间 JavaScript      更新时间:2023-09-26

在这里我只检查sapaces

if (/^'s*$/.test(txtSSAETitle.value) || /['s]/.test(txtSSAETitle.value)){
    txtSSAETitle.focus();
    alert("AE title should not be blank.");
    return false;              
}
但是[空间约翰空间亨利]

或[约翰空间亨利]这应该是允许的。(不会为此生成警报)

如果您想检查输入是否仅包含空格,请修剪输入并检查结果的长度,我会说。喜欢:

if ( txtSSAETitle.value.replace(/^'s+|'s+$/,'').length<1 )  {  /* etc */ }