When I create input color class element, javascript adds listeners authomaticaly, but when I add by "add" function. listeners don't added authomatically. What can I do?
<script type="text/javascript">
function add() {
alert("movida");
var child = document.createDocumentFragment();
var tmp = document.createElement('input');
tmp.className = 'color';
child.appendChild(tmp);
document.body.appendChild(tmp);
}
</script>
</head>
<body>
<input class="color" >
<input class="color" >
<p onclick="add()" > add</p>
</body>
here is js file http://pastebin.com/yzja4iNV
I just called jscolor.init(); end of function and it worked :)