Header menu

_________________________________________________________________________________

Friday, 13 September 2013

Prepend some (text/img) before some html element using jquery

How to prepend some (text/img) before some html element using jquery 

<html>
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script type="text/javascript" >
        $(document).ready(function(){
var i=0;
            $("#sub").on("click",function(){
$( "#1" ).prepend("Test "+i+" ... ");
                 i++;
                 });      
            });
 
        </script>
        </head>
    <body>
<div id="1">This is my test...</div>
<button type="button"  id="sub">Prepend</button>
</form>
</body>

</html>