Hard Rain Hard Rain - 1 year ago 67
HTML Question

How to create a new html element?

I tried to create a new HTML element, called test:

<test>some text</test>

I tried to prototyping it like this:
HTMLUnknownElement.prototype.style.backgroundColor = "red";
but it doesn't work.

Could you please help me, how to manage it?

Thanks in advance,

Answer Source

There isn't really a reason to do that.

When you want to create an element with red background, you should use an existing element and assign a CSS class to it which has red background (like <span class="test">) .

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download