The document.registerElement() method is used to create a custom HTML element. This should be passed as the name of your custom element along with an (optional) object that defines the API.
Declare them:
<x-foo></x-foo>
Create DOM in JS:
var xFoo = document.createElement('x-foo'); xFoo.addEventListener('click', function(e) { alert('Thanks!'); });
Use the new operator:
var xFoo = new XFoo(); document.body.appendChild(xFoo);
Thanks for the reply, I am able to create the String with <text></text>,But the issue is I need to convert this into a html tag and not as a text or string. It should appear in the DOM and not in the page.
Thanks!
Hi
I am not sure what exactly is your Question.
Just go to Component.html and create a Tag that your would want to create.
Like :-
See the DOM :-
If you want to create a tag using some string generated from sightly, then you can create a JavaScript with the function accepting a string (sightly string) and this JS function can create a tag for you.
Thanks for the reply, I am able to create the String with <text></text>,But the issue is I need to convert this into a html tag and not as a text or string. It should appear in the DOM and not in the page.
Thanks For your reply, I went through the document it was helpful indeed, but I am not able to quite achieve what i wanted to, Can you please tell me the syntax for the above mentioned requirement.
PS:- To get Hex value of any character, you can use "http://www.endmemo.com/unicode/unicodeconverter.php". Enter a character in Unicode Character and look for result in Escaped Unicode. Also if Escaped Unicode is coming out to be \u3e use it as \u003e.
Thanks For your reply, I went through the document it was helpful indeed, but I am not able to quite achieve what i wanted to, Can you please tell me the syntax for the above mentioned requirement.