Thursday, 5 September 2013

Adding arbitrary information to createElement object

Adding arbitrary information to createElement object

This w3schools page mentions the HTML DOM createElement() Method. For
example, you can create a button by
var btn = document.createElement("BUTTON");
Now, I want to attach some information to this button. What is the
appropriate way to do it? If I want to attach the array ["one", "two",
"three"], can I just do
btn.myOwnInformation = ["one", "two", "three"]
?

No comments:

Post a Comment