Append SPAN one after another : children « jQuery « JavaScript DHTML






Append SPAN one after another

     
<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("input").keypress(function (e) {
                var c = String.fromCharCode(e.which);
                $("p").append($("<span/>")).children(":last").append(document.createTextNode(c));
                $("div").text(e.which);
            });
        });
    </script>
  </head>
  <body>
    <body>
     <input type="text" />
      <p>Add text - </p>
      <div></div>

    </body>
</html>

   
    
    
    
    
  








Related examples in the same category

1.Children from DIV
2.Get target children length
3.children(expr): filter with an optional expression
4.Attaches a change event to the select that gets the text for each selected option
5.Add class to all children from UL