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 :: factorial in javascript 
Javascript :: alphabet as array javascript 
Javascript :: input field take only number and one comma 
Javascript :: javascript onsubmit 
Javascript :: find is not a function javascript 
Javascript :: jquery serialize with file upload 
Javascript :: p5js cdn 
Javascript :: dociql process.env.NODE_TLS_REJECT_UNAUTHORIZED=0 
Javascript :: js add to array conditionally 
Javascript :: jsp include html 
Javascript :: js input type range on hover 
Javascript :: javascript remove item onclick 
Javascript :: get date js 
Javascript :: javascript sql 
Javascript :: how to disable onclick event in javascript 
Javascript :: javascript set html select value 
Javascript :: javascript reverse loop 
Javascript :: make first letter capital 
Javascript :: how to reset node command prompt 
Javascript :: react native shadow above 
Javascript :: Rename files in a directory with node.js 
Javascript :: how to trap js errors window.onerror 
Javascript :: javascript change background color 
Javascript :: delete all the rows of table javascript 
Javascript :: javascript calculate 24 hours ago 
Javascript :: promise in forloop 
Javascript :: jquery select2 how to make dont close after select 
Javascript :: last element in array 
Javascript :: how to add oAuth google signin in react native app 
Javascript :: math.factorial 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =