david001
1 month ago
288
3
Vue

Vue model binding for jquery datapicker

Posted 1 month ago by david001

I am using jQuery date picker and its working perfectly. I am in Vue component. when I click the date input field it shows date picker but when I choose one date and see the result in the console I got nothing. Date is not bind.

<form @submit.prevent="search()">
    <div class="card">
        <div class="card-body">
            <div class="card-header"></div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-8">
                        <input type="text" v-model="date"  class="form-control" id="datepicker" >
                    </div>
                    <div class="col-md-4">
                        <button class="btn btn-primary" >Search</button>

                    </div>
                    
                </div>
                
            </div>
        </div>
        
    </div>
    </form>

<script>
    export default {
        data(){
            return{
                date:''
            }
        },
        mounted() {
            console.log('Component mounted.')
        },
        methods:{
            search){
                console.log(this.date)
            },
          

        },
   
    }
</script>

when i click the search button , i should get the date in console but i got nothing, How to get current selected date by user? Thank you

Please sign in or create an account to participate in this conversation.