Dynamic Textbox Menggunkan Vue Js

	
<div id="app">
  <button v-on:click="addField(0)"class="btn btn-xs btn-primary">Add</button>

  <div id="kmp"></div>
                                    
  <div v-for="field in fields">
    
    <input type="text" v-model="field.nama">
   

    <button class="btn btn-danger btn-xs" @click="removeField($index)">remove row</button>                         

  </div>
  
</div>
	<script type="text/javascript">
		

new Vue ({
	el:"#app",
  data:{
  	fields:[
    {nama:'aditya'},
      ]
  },
  methods:{
  	addField:function(index){
    	try {
                this.fields.push({nama:''});
            } catch(e)
            {
                console.log(e);
            }
    },
    removeField: function (index) {
            this.fields.splice(index, 1);
   	},
  }
})


	</script>

Demo

Aditya Suryadi

Aditya Suryadi
just ordinary people

Dynamic_textbox_jquery

Menambah dan Menghapus Textbox DinamisHTML <div id="kmp"></div> <input type="button" class="btn btn-xs btn-primary" value=...… Continue reading

Backup Db Menggunakan Php Dan Mysql Di Windows

Published on January 18, 2017

merubah string jadi variabel di PHP

Published on January 13, 2017