我有一个函数,我想在最后一行完成后再次调用它。
如果我展示代码也许会更容易理解。
function updateQuantity(){
// further code where I change same data
// and now I want to start function again but with remembering the input element that called it previously
updateQuantity(this); // I tried it this way but it doesn't work
}
任何想法?
答案很简单,用一下就够了updateQuantity.call(this)
在 - 的里面updateQuantity
功能 - 当我们使用call
并添加this
,该函数将再次启动并记住之前调用的输入元素updateQuantity
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)