davidsleeps davidsleeps - 6 days ago 5
Javascript Question

Is there an easy way to convert jquery code to javascript?

There are lots of examples out there of achieving certain things in javascript/dom using jQuery. However, using jQuery is not always an option which can make understanding the examples of javascript solutions written in jQuery hard.

Is there an easy way to convert jQuery code to regular javascript? I guess without having to access or understand the jQuery source code.

Answer

The easiest way is to just learn how to do DOM traversing and manipulation with the plain DOM api (you would probably call this: normal JavaScript).

This can however be a pain for some things. (which is why libraries were invented in the first place).

Googling for "javascript DOM traversing/manipulation" should present you with plenty of helpful (and some less helpful) resources.

The articles on this website are pretty good: http://www.htmlgoodies.com/primers/jsp/

And as Nosredna points out in the comments: be sure to test in all browsers, because now jQuery won't be handling the inconsistencies for you.

Comments