I'm trying to create a custom element HTML5, I extend input tag
you can see my code here :
<form id="form">
login : <input type='text' id='login' class='form-control'/>
password : <nc-input id='pass'/>
name : <input type='text' id='name' class='form-control'/>
</form>
<script>
//declare a function that create tag
function createTag(tagName,HTMLElementType,HTMLName,HTMLType)
{
var proto = Object.create(HTMLElementType.prototype);
proto.createdCallback = function() {
this.type = HTMLType;
this.className = 'form-control'
};
//var host = document.querySelector("#form");
//var shadow = host.createShadowRoot();
var nCB = document.registerElement(tagName, {
prototype: proto,
extends: HTMLName
});
document.body.appendChild(new nCB()); //JS DOM
}
createTag('nc-input',HTMLInputElement,'input','text');
</script>
http://jsfiddle.net/NABILDEV/5z44v30x/22/
using this line : document.body.appendChild(new nCB());
it displays the input on the bottom of the page and not inside my form (next to password label).
my purpose is to create my own tag's library, so I can use them in my project
Thanks.