Closed jay7793 closed 6 years ago
Template code.
<form id="answerForm" @submit.prevent="createAnswer" @keydown="form.onKeydown($event)"> <input type="text" name="title" v-model="form.content"> </form> <v-button type="primary" @click.prevent="answerSubmit" class="btn-sm" :loading="form.busy">Submit</v-button>
I created answerSubmit() method inside Vue.js for submit form. But does not work.
answerSubmit () { document.getElementById('answerForm').submit() },
PS. I'm using https://github.com/cretueusebiu/laravel-nuxt starter
Why don't you just call createAnswer when you click on the submit button ?
createAnswer
But if you really want to trigger the form use dispatchEvent: https://codepen.io/anon/pen/PQqGVg?editors=1010
dispatchEvent
Template code.
I created answerSubmit() method inside Vue.js for submit form. But does not work.
PS. I'm using https://github.com/cretueusebiu/laravel-nuxt starter