Currently, my javascript is creating pages dynamically, so when the user clicks X, the new html code is generated for that option, if B then vice versa.
Although, I'm getting "undefined" errors. Even though I do check for the variables before they're passed into the function.
My current non-working prototype looks like this
var appName;
if(evt.target.getAttribute("appName") != "" || evt.target.getAttribute("appName") != null){
appName = evt.target.getAttribute("appName");
}
Before that, I've tried using something which looks like this
var appName = evt.target.get("appName");
if (typeof appName != typeof undefined && appName !== false) {
appName = evt.target.getAttribute("appName");
}
else appName = 'boo';
That still returns undefined.
Lastly, I tried more or less the same approach but it still returns
Uncaught TypeError: Cannot read property 'getAttribute' of undefined
The code for the following looks like that :
var appName = '';
if(evt.target.hasAttribute("appName")){
appName = evt.target.getAttribute("appName");
}
else appName = 'boo';
How would I check if the attribute is actually set and I can proceed if not then I would like to pick alternate course for the code.
Thanks for your help and time spent.