I'm trying to set multiple attributes to an element at one shot. I found this answer, and this comment to that answer. In the JSFiddle there, he doesn't use a string for the property name, as opposed to the answer which uses a string.
The problem with the JSFiddle in the comment, is that it doesn't have the ability to edit the text for the element. I tried adding that capability, but it didn't work.
I added the following at line 7:
else if (at[prop] === html) {
this.innerHTML = set[idx];
}
But I got the following error:
Uncaught ReferenceError: html is not defined
How can I add the functionality of changing the text to the commented JSFiddle?
Code
Comment JSFiddle (edited)
htmlis not defined in your code..I guess it should be'html'in condition..console.login that if statement, you see it never gets calledelse if (at[prop] === html) { this.innerHTML = set[idx]; }in line 7? Did you change the variables in the given JSFiddle link because in that code, first of allat[prop]is not a variable. You may replaceattrswithatbut herepropis the index ofattrs[idx]. So I just don't get it.