Daryl Wong
Daryl Wong

Reputation: 2443

VueJS: Change placeholder after form submission

I have like to clear the placeholder of a form after form submission. However my code below doesn't seem work. It doesn't clear the input textfield.

data() {
  return {
    placeholder: "https://www.youtube.com/watch?v=VooQbNHP44M",
  };
},

<form @submit.prevent="submitVideo">
 <div class="flex">
   <input
     type="text"
     :placeholder="placeholder"
     v-model="yturl"
   />

async submitVideo() {
   this.placeholder = "";
}

Anyhelp would be greatly appreciated.

Upvotes: 0

Views: 114

Answers (1)

Sina
Sina

Reputation: 1135

async submitVideo() {
  this.placeholder = "";  // clears placeholder value
  this.yturl = "";  // clears input value
}

Upvotes: 1

Related Questions