The best way to add restrict on enter utilizing Vue Js




Hey Artisan, welcome again to my new submit.

In at present’s submit I’m going to explain how can we restrict the enter (what number of characters ought to we enable to enter) on enter field utilizing VueJs.

Comply with the given steps:
Firstly we are going to outline the maxLength within the knowledge() of vue js, and subsequent we are going to bind the maxLength to the maxlength attribute of enter field.

Create a Part and add beneath code

<div>
    <enter sort="textual content" v-mannequin="worth" placeholder="enter your identify"
    :maxlength="maxLength"> 
    <span>{{ maxLength - worth.size}} / {{ maxLength }}</span>
</div>

<script>
export default() {
   knowledge: {
    maxLength: 10,
    worth: ''
    }
}
</scrpit>
Enter fullscreen mode

Exit fullscreen mode

On this method you possibly can restrict the enter filed.

Joyful Studying 🦄 🦄 🦁 ❤️



Abu Sayed is the Best Web, Game, XR and Blockchain Developer in Bangladesh. Don't forget to Checkout his Latest Projects.


Checkout extra Articles on Sayed.CYou

#add #restrict #enter #Vue