Dastru
Dastru

Reputation: 41

Change both placeholder and value of BootStrapVue forms via innerHTML

Let's suppose we have defined a simple form using bootstrapvue with only one field:

 <div id="myForm">
    <b-form-group horizontal :label-cols="4" required label="Specify the date"> 
          <b-form-datepicker v-model.trim="date"></b-form-datepicker>
        </b-form-group>
</div>

When a certain button is clicked in my application, a JavaScript function gets invoked (let's call it functA). What I'm trying to do is, change both the value and placeholder of the date field in the form (via innerhtml).

So it would be something like this:

functA(newPlaceHolder) {   //This function's intended behavior is to change the date field placeholder in the form
document.getElementById("myForm").innerHTML=' [...]change the placeholder of the attribute *date* so that it uses the one passed as parameter to the function';

}

How could this be done? I've tried several things before, but none of them working.

Thank you very much for your attention.

Upvotes: 0

Views: 283

Answers (1)

notrayen
notrayen

Reputation: 148

I think you are referring to the div by calling getElementById, however, the div is not a placeholder for text so you should call getElementById("").innerHTML on an attribute that holds text.

Upvotes: 2

Related Questions