onchange > custom Object properties
This commit is contained in:
parent
daea4892ad
commit
5e193f6d18
@ -12,8 +12,15 @@
|
||||
newInput.setAttribute('name', tagName + '-flag');
|
||||
newInput.setAttribute('type', 'text');
|
||||
newInput.setAttribute('id', tagName + '-flag');
|
||||
newInput.onchange = onChangeHandler;
|
||||
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){
|
||||
|
Loading…
Reference in New Issue
Block a user