I have the following block of code where I ewant to set the node value based on the focus event so that I can reuse this block of code. It works when I use this line: node = document.getElementById('ownerAddress');
but not when I try to set node to a variable. I also have node declared as a global variable. I thought I could access it since I returned the value in my getElementId function and then use the node.value in the checkAddress function, but there is no value at that time. What am I doing wrong in this block?
on(document.getElementById('ownerAddress'), 'focusout', checkAddress);
on(document.getElementById('ownerAddress'), 'focusin', getElementId);
function getElementId() {
console.log(document.activeElement.id);
node = document.activeElement.id;
console.log(node);
return node;
}
function checkAddress() {
var locator = new Locator("http://maps.decaturil.gov/arcgis/rest/services/Public/WebAddressLocator/GeocodeServer");
//console.log(document.getElementById('ownerAddress').value);
//node = document.getElementById('ownerAddress');
// according to your service it takes Single Line
var params = {
"Single Line Input": node.value
};