What are the advantages of jQuery over writing JavaScript myself?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/863603/when-should-i-use-a-javascript-framework-library">When should I use a javascript framework library?</a>  </p>
</blockquote>



<p>All,</p>

<p>I'm fairly new to web app development.</p>

<p>Recently, I've built a few HTML5 apps specifically targeted at iPads and iPhones.</p>

<p>I've noticed that very few people seem to use straight JavaScript - virtually everyone uses jQuery (Prototype, YUI, Mootools, etc. seems somewhat less popular).</p>

<p>If I'm starting out - SHOULD I use jQuery? Or, would I be better off writing my own JavaScript?</p>

<p>In general - I prefer using as much of "my own" code as possible. I'm uncomfortable using a framework if I can avoid it - I feel like it prevents me from understanding what's going on "underneath the hood."</p>

<p>(Sure - even if I'm using straight JavaScript - there are many levels "underneath the hood" (e.g., browser's JavaScript enging, the OS, kernel, etc.), that I don't understand, but the lower the level I <em>do</em> understand, the better.)</p>

<p>The only concrete advantage I can think of for not using jQuery... loading the ENTIRE jQuery framework, when I only need a handful of it's functions - seems unnecessary and wasteful.</p>

<p>So - in general - would I be better off creating my own, highly-tailored, application-specific JavaScript for each project?</p>

<p>Or - should I bite the bullet, get over my reluctance to use someone else's code, and use jQuery? Are there advantages to it besides just not having to create my own versions of functions that have already been written by someone else?</p>

<p>E.g., are it's functions somehow optimized or more efficient than what I could produce on my own?</p>

<p>[UPDATE]</p>

<p>One of the common themes in the answers so far... jQuery eliminates the need to worry about browser differences. Good point.</p>

<p>By in my case, I'm writing apps specifically for the iPhone, iPad, and Android. As far as I know - the browsers are pretty consistent. The vagaries and idiosyncrasies of IE6, 7, and 8 really don't seem to apply. Is that true? If so, does it eliminate a major reason for using jQuery?</p>

<p>Another key issue... jQuery is so popular, that there's a good chance that it's already in the user's cache, thus eliminating the need to load it. True... but is that the only performance hit? In other words... does the existence of the hundreds of functions that are part of jQuery impact the performance of my page? (I don't know how JavaScript engines work, so I have no idea if this is the case...).</p>

<p>Many thanks in advance for your advice and guidance.</p>
