An Interest In:
Web News this Week
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
October 14, 2021 05:32 pm GMT
Original Link: https://dev.to/snehalk/how-to-add-limit-on-input-using-vue-js-3eco
How to add limit on input using Vue Js
Hey Artisan, welcome back to my new post.
In today's post I am going to describe how can we limit the input (how many characters should we allow to enter) on input box using VueJs.
Follow the given steps:
Firstly we will define the maxLength
in the data() of vue js, and next we will bind the maxLength to the maxlength
attribute of input box.
Create a Component and add below code
<div> <input type="text" v-model="value" placeholder="enter your name" :maxlength="maxLength"> <span>{{ maxLength - value.length}} / {{ maxLength }}</span></div><script>export default() { data: { maxLength: 10, value: '' }}</scrpit>
In this way you can limit the input filed.
Happy Reading
Original Link: https://dev.to/snehalk/how-to-add-limit-on-input-using-vue-js-3eco
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To