无论如何,我可以使用javascript检查输入是否为空,然后运行函数吗?如果可能的话,我希望它包含在输入中。
有onChange
,有ifEmpty
大声笑吗?
答案 0 :(得分:0)
<input onChange="this.value.trim().length > 0 && myFunction()" />
答案 1 :(得分:0)
尝试一下
function a(e)
{
if(e.value=="")
return false;
else
console.log('there is a value')
}
<input value="" onclick="a(this)">