Using variables in onclick (keep old variable value even if changed later)

I have a problem where I need to dynamically add onclick events in javascript buttons using variables that the user gives. The problem: These variables will change, but I dont want the onclick events to all change!! I wrote up a mini example that mimics the setup I have (but obviously getting rid of unnecessary parts and therefore looks a bit silly). NOTE: I tried to clone the variable using these: Neither worked Here is the codepen: https://codepen.io/samuel-solomon/pen/ExPqdpM HTML: CSS Javascript Answer You can use Function#bind to designate a specific value as the first parameter of the event handler. This

Vuelidate: validate on click, not when field touched

I’m kinda new to vuelidate, and everything works fine, except I have no clue how to run validation only when the button Submit has been clicked. Right now it marks touched field red when you start providing any input and I’d like it to wait with that, till user wants to submit filled form. Here’s what I’ve got up to now: Answer I could never really get used to the Vuelidate way of doing things, but, generally speaking, it works like this: https://monterail.github.io/vuelidate/#sub-basic-form Setting it up like this allows you to have validation for each form input/element and then an