2

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

Chandan Rai
  • 9,879
  • 2
  • 20
  • 28
radeveloper
  • 926
  • 2
  • 12
  • 20

1 Answers1

10

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>
CD..
  • 72,281
  • 25
  • 154
  • 163