vue.js disable input conditionally

vue.js disable input conditionally

Asked on November 13, 2018 in vue.js.
Add Comment


  • 2 Answer(s)

              To eliminate the disabled property,  set its value to false. It should be the Boolean value false, not the string ‘false’
    If the value is validated as 1 or 0, then set disabled property based on that value

    <input type="text" :disabled="validated == 1">
    

     

    Answered on November 13, 2018.
    Add Comment

    Just check with this,

    <button @click="disabled = !disabled">Toggle Enable</button>
    <input type="text" id="name" class="form-control" name="name"  v-model="form.name" :disabled="disabled">
    
    Answered on November 13, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.