我有这个函数应该返回一个对象,当它发现它,但它不这样做。 我在做什么错?jquery函数返回对象
var getEl = function(title){
var theInputs = $('input[type=text], input[type=radio], input[type=checkbox], select, textarea')
theInputs.each(function(){
if (this.title==title){
getEl = this
console.log('found it!')
}
})
}
console.log(getEl('Office Status'))
我知道,它的作品,因为发现它是在控制台上的输出,但控制台报告不确定的,因为这行的输出:
console.log(getEl('Office Status'))
哪里'return'语句返回元素? –
你有可能在某些时候用vbscript开发过吗?我想我已经看到了通过将它分配给之前的函数名称来返回值的模式。 –
为什么不只是使用过滤功能? –