我想将以下内容重写为HTML模式:
if (/\S/.test(myString)) {
// string is not empty and not just whitespace
}
因此
<input pattern="\S" required">
if ($('form :invalid'))
console.log('empty');
else
console.log('has non-whitespace char');
我的问题是我的模式与测试字符串不一样。我想检查是否至少有1个非空格字符。