javascript - createElement auto listeners -


when create input color class element, javascript adds listeners authomaticaly, when add "add" function. listeners don't added authomatically. can 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 js file http://pastebin.com/yzja4inv

i called jscolor.init(); end of function , worked :)


Comments