检查对象是否是文本框 - javascript
我知道我们可以使用 (javascript)
I understand that we can use (javascript)
if (typeof textbox === "object") { }
但是有没有方法可以让我确保对象是一个文本框?
but are there methods which will allow me to ensure that the object is a textbox?
推荐答案
var isInputText = obj instanceof HTMLInputElement && obj.type == 'text';
相关文章