Categories
Vue Answers

How to disable input conditionally with Vue.js?

Spread the love

To disable input conditionally with Vue.js, we set the :disabled prop.

For instance, we write

<template>
  <input type="text" :disabled="!validated" />
</template>

to set the disabled prop to the negation of the validated reactive property.

The input will then be disabled when validated is false.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *