Can I check if input has value?
lavezzi1 opened this issue · comments
lavezzi1 commented
vue 1.0.28
validator 2.1.7
Can I check if input has value (initially when page is loaded?) then apply some class? I know I can work with 'modified' event but it works only when user change value. Thanks!
kazuya kawaguchi commented
Yes, you can do.
As far as I understand your comment, the following.
<div id="app">
<validator name="validation1">
<input type="text" :value="msg" v-validate:comment="['required']"/>
</validator>
</div>
lavezzi1 commented
@kazupon I'll try to explain deeply. I want to implement floated label, so when you click on input and enter some value the label should appear on the top left corner. I can do this:
:class={'show-label': $validation.modified}
But problem comes when input has some value initially. So how to determine that input already modified or something? And apply the show-label initially in this case.