Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable an input box by clicking a button using vue js 2.0

How can I disable an input box via clicking a button and toggling it using vuejs 2.0

like image 283
radeveloper Avatar asked Jan 25 '26 16:01

radeveloper


1 Answers

You can bind disabled, see an example:

new Vue({

  el: '#app',
  data: {
    isDisabled: false
  }

})
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="app">

  <input type="text" :disabled="isDisabled">
  <button @click="isDisabled = !isDisabled">Click</button>

</div>
like image 116
CD.. Avatar answered Jan 27 '26 08:01

CD..



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!