Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

vue submit form

<form v-on:submit="addProduct">
        <input type="text" v-model="name" placeholder="Product Name" >
        <input type="number"  v-model="price"         placeholder="Price" >
        <button type="submit">Add</button>
      </form>

  
 Run code snippet
Comment

submit form in vue

//HTML
<div id="vueRoot">
  <form ref="form">
    <input name="vitalInformation" v-model="store.vital">
    <a href="#" v-on:click="submit">SUBMIT</a>
  </form>
</div>

//JS
vm = new Vue({
  el : "#vueRoot",
  methods : {
    submit : function(){
      this.$refs.form.submit()
    }
  }
});
Comment

vue submit form

data: function(){
     return {
       name: "",
       price: "",
   }
},
 methods: {
    addProduct(e){
      e.preventDefault() // it prevent from page reload
      // console.log(this.name, this.price);
    }
  }
Comment

javascript submit form VUE

<div id="vueRoot">
  <form ref="form">
    <input name="vitalInformation" v-model="store.vital">
    <a href="#" v-on:click="submit">SUBMIT</a>
  </form>
</div>
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript set value to the largest value in an array 
Javascript :: test one function in react class 
Javascript :: iterate array 
Javascript :: generate new component angular 
Javascript :: add update react pwa feature 
Javascript :: useQuery by click 
Javascript :: animated node with tag 1 does not exist 
Javascript :: formgroup angular 
Javascript :: what is tostring in js 
Javascript :: javascript sort multi-dimensional array 
Javascript :: nestjs prisma on query 
Javascript :: vue route automatic redirect 
Javascript :: scrollview pull to refresh react native 
Javascript :: hammerjs 
Javascript :: ejemplo async await javascript 
Javascript :: angularjs - controllerAs 
Javascript :: Object Property Shorthand javascript 
Javascript :: error handling in node js 
Javascript :: how to access node js server from another computer 
Javascript :: react fetch data in for loop 
Javascript :: setstate 
Javascript :: tailwind rn npm install 
Javascript :: redirect all routes to main component vue 
Javascript :: sequelize db:create test environment 
Javascript :: how to create an html element in javascript without document 
Javascript :: server smtp 
Javascript :: npm ERR! code EPERM 
Javascript :: push array into array javascript 
Javascript :: add marker on map geocoder result mapbox 
Javascript :: if statemnt shorthand js without else 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =