Converting Jquery(.each, .find,.next) To Javascript
Solution 1:
You may use below for your work, but beware they might not work with all browsers. It is always safe to use jQuery if possible.
// jQuery -> JavaScript
.each -> array.forEach(callback[, thisArg])
.find -> document.querySelector(selectors), document.querySelectorAll(selectors);
Solution 2:
You can definitely do this if you must, jQuery is just a layer that sits on top of javascript. When you write jQuery, you're writing javascript.
If you really need to go down this route, it might be helpful to look at the jQuery source. James Padolsey made a really helpful tool for inspecting the various methods that jQuery provides. You can see the tool here: http://james.padolsey.com/jquery/#v=git&fn=jQuery.fn.next.
Keep in mind that the jQuery team has spent years getting their code to work efficiently and for multiple browsers. Please don't be surprised if your code fails across browsers.
Solution 3:
You could start looking at these functions code at github. .find = https://github.com/jquery/jquery/blob/master/src/traversing.js#L13 .each = https://github.com/jquery/jquery/blob/master/src/core.js#L541
Post a Comment for "Converting Jquery(.each, .find,.next) To Javascript"