I have a function that I want to call again inside, after the last line finishes.
Maybe it will be more understandable if I show code.
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
}
Any idea?
The answer is simple, it is enough to use updateQuantity.call(this)
inside the updateQuantity
function - when we use call
and add this
, the function will start again and remember the input element that previously called updateQuantity
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With