JSFiddle - React, Tailwind, and code Playground
JavaScript
function CustomElement() {
var ele = document.createElement("input");
ele.type = "button";
ele.value = "Testing";
// do stuff to ele
ele.CustomProperty = {one:"two", three:"four"};
ele.toString = function(){
return '<input type="'+this.type+'" value="'+this.value+'" />';
};
return ele;
}
var tmp = CustomElement();
document.body.innerHTML += tmp;
tmp.id = "Test";
document.body.appendChild(tmp);
console.log(tmp.CustomProperty);
console.log(document.getElementById("Test").CustomProperty);