onchange > custom Object properties

This commit is contained in:
Cappy Popp 2021-01-06 13:41:08 -05:00
parent daea4892ad
commit 5e193f6d18

View File

@ -11,9 +11,16 @@
newInput.style.left = '-999em';
newInput.setAttribute('name', tagName + '-flag');
newInput.setAttribute('type', 'text');
newInput.setAttribute('id', tagName + '-flag');
newInput.onchange = onChangeHandler;
newInput.setAttribute('id', tagName + '-flag');
newInput.style.display = 'none';
newInput._value = newInput.value;
Object.defineProperty(newInput, "value", {
get: function() { return this._value; },
set: function(v) {
this._value = v;
onChangeHandler(v);
}
});
hiddenLinkedInInputs.appendChild(newInput);
fillScript.setAttribute('data-field-' + tagName, tagName + '-flag');
};
@ -44,11 +51,11 @@
// [2] To allow us to map the ISO country code LinkedIn provides us
// to the [sigh] full-text version of the country our select element
// requires
hiddenInputCreator('email', function () {
hiddenInputCreator('email', function (newValue) {
// fire the GA event for autofill
});
hiddenInputCreator('country', function () {
console.log(this.id + " changed!");
hiddenInputCreator('country', function (newValue) {
console.log("%s value changed to %s", this.ID, newValue);
// map to the country we have in our select dropdown
var countries = {
US: 'United States',
@ -253,7 +260,7 @@
},
country = document.querySelector("#Country");
// sets the value in the form the user can see
country.value = countries[this.value.toLowerCase()];
country.value = countries[newValue.toLowerCase()];
});
/*['email', 'country'].forEach(function(inputField){