radeveloper
radeveloper

Reputation: 946

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

Upvotes: 2

Views: 6993

Answers (1)

CD..
CD..

Reputation: 74126

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>

Upvotes: 10

Related Questions