Creating an element and handle its blur event - Javascript DOM Event

Javascript examples for DOM Event:onblur

Description

Creating an element and handle its blur event

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from  www .  j  av a 2 s. co  m*/
function foo() {
    console.log('Works!');
}
var inp = document.createElement('input');
inp.onblur = foo;
document.body.appendChild(inp);
document.body.innerHTML += '<br>';
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials