JavaScript is Disabled!Although you can view all of this site without JavaScript, there are features designed to provide enhanced functionality that will not function. Since this can affect the flow of things and performance, you may consider enabling JavaScript to better enjoy the site.If you are a NoScript (Firefox)/HTTP Switchboard [aka uMatrix] (Chrome) user, as a contributing member of both projects,
I can assure you that this site's scripts are 100% safe and you may confidently whitelist.For instructions on how to enable JavaSript, go here

Question

I was asked a question today about how to do the same thing as prepend in jQuery but without loading and using that library, so bascially to do it in pure JavaScript.

For most programmers, this kind of “equivalency”, if you will, is often fairly easy to do and the reason we opt for libraries like jQuery is more for convenience and consistency than inability.

This is to show there is no magic to it (most of the time) and when you pull back the veil and understand what is happening, you realize that jQuery simply takes the pains of repetition and ugliness out of your code.

For the love of all that is holly, don’t do these ugly one line chains please. Sacrifice a negligable amount of overhead and make your code more readable by expanding your syntax a bit to be more clear.

If for no other reason than to be self-serving and have an easier time debugging and detecting typos. Or, consider that you will type less in the long run which would actually make your code more efficient. If that wasn’t enough, consider that you will enjoy better logic flow and conceptualization as well.

Ultimately, to each their own, but hopefully this was a nice little token refresher. LLC away. — Mike

There should be no implication that jQuery is any less JavaScript, just that one is at its stock core and the other has extended functionality wrapped around it in a library that can expedite or shorthand a lot of what would be otherwise tediously long and ugly. That fact that a dedicated community of awesome people maintain the code all the time relieving you of having to constantly audit your code is just gravy.

Show Your Support – We Don’t Believe in Disruptive Ads

Semper Fidelis

Always Faithful, Always Forward

Places to find me:

StackExchange Google&plus;

Twitter : Follow GitHubFollow @GuardianMajor ello deviantArt Facebooki have made a personal choice after their "name policy" witch hunt which repeats every 2 years it seems at the whim of the "bully mob" (even when they make you jump through hoops and verify you), to just quit it and be done with it, they are not worth my time. I don't need it, I don't miss it, in fact it has made my life more productive and void of gross hate, vitriol and drivel. To those who say they can't stay in touch if I am not on there, if you can't reach me because I am not on Facebook, then you are not trying AT ALL - therefore, good riddance. Scribd NoScript/FLashGot (Informaction)