Vue.js enable disable button
We can use disable attribute to enable and disable the button conditionally. Here in this tutorial, we are going to explain how you can use this attribute in vuejs to make a button enabled or disabled.
Vue.js enable disable button Example
You can make a button enabled or disabled simply using the below-
Example:
<div id="app"> <p><input type="button" :disabled=enableDisable value="Open Modal"></p> <button @click="myFunction()">Enable/Disable</button> </div> <script> new Vue({ el: '#app', data: { enableDisable:false }, methods:{ myFunction: function () { if(this.enableDisable){ this.enableDisable = false; }else{ this.enableDisable = true; } } } }); </script> |
Output of above example-
Advertisements