Vue v-model binding


#1

Wondering if it’s possible to inject a custom attribute to the bootstrap controls.

e.g.


#2

Here’s one way, assuming you have a BS input control named Input1.

To set it:
Input1.setAttribute('customname', 'value')

To get it:
Input2.getAttribute('customname') 'returns "value"

Kind regards,
Doug


#3

You seem to be mixing BASIC and JavaScript. This will work in both:

Input1.setAttribute("customname", "value")

Input2.getAttribute("customname")

#4

Thanks for fixing that George. Actually, I just forgot to use double-quotes around the key/value pair. The ‘returns…’ part was intended to be a BASIC comment.

Doug


#5

In case anyone else wants to use Vue (there may be other ways). I had already looked at setAttribute. The issue was I had already created my Vue object. So I just needed to rearrange my code.