我有一个函数,我想在最后一行完成后再次调用。如何调用其内部的函数
如果我显示代码,这可能会更容易理解。
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
}
有什么想法吗?
那该怎么办?这是递归的经典案例(除非你需要终止条件)。当你再次打电话时,你是否想要拥有相同的“this”值? –
@MikeC也许OP试图保留'updateQuantity'的前一次运行中设置的变量? – andlrc
我想功能记住我想在这个功能中使用的输入元素 – cyprian