Q:

Using JavaScript and jQuery in same file

Can I use JavaScript and jQuery side by side on the same file or element?
I heard that this is possible: why doesn't the code below work? If I get some element using jQuery(#) and then use innerHTML to change it, it doesn't work. So, for example,
<body>  
  <script> 
     $(function(){
     var b= $('#p');
     b.innerHTML="wow";
     });
  </script>
  <p id="p">hey</p>
</body>

A:

jQuery is a superset of JavaScript. It IS JavaScript! Just a neat tool set for JavaScript so widely used it's almost considered essential to many people.
That being said, jQuery selections are jQuery objects and have some specific properties. They aren't 100% compatible with normal DOM nodes. It's best to stick with one or the other. There are only rare cases where you need to use standard JavaScript anyway because jQuery has so many methods available to you. In this case use:
$(function(){
    var b= $('#p');
    b.text("wow");
});

If you really want to get the DOM node out of that you'll have to use the array reference which can give you the node, but this means that either you'll only effect the first element such as in this case: 
$(function(){
    var b= $('#p');
    b[0].innerHTML = "wow";
});

or you'll have to loop through and change each element one by one like this:
$(function(){
    var b= $('#p');
    for(var i = 0; i < b.length(); i++) {
       b[i].innerHTML = "wow";
    }
});

