Add data to each tag with prepend : prepend « jQuery « JavaScript Tutorial






<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
             $("*", document.body).each(function () {
                  $(this).prepend(document.createTextNode("data"));
                  
             });
        });
    </script>
    <style>
      .y { background:yellow; }
  </style>

  </head>
  <body>
    <body>
       <div><button disabled="disabled">First</button> <span class="selected"></span>
            <span></span>
       </div>

  </body>
</html>








30.80.prepend
30.80.1.Add data to each tag with prepend
30.80.2.Prepend content to the inside of every matched element
30.80.3.Prepend query
30.80.4.Prepends a DOM Element
30.80.5.prepend(content): insert elements inside
30.80.6.Prepends some HTML to all paragraphs.
30.80.7.Prepends a DOM Element to all paragraphs.