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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -