I’m going to write some premise-posts to my recent experience with a native app for iPhone wrapped with PhoneGap. Before to reach that point, I would like to focus on how, in certain circumstances (E.g., mobile development), there is no need to include heavy libraries like jQuery, causing often poor performance especially on less recent devices like iPhone 3G.
The first appointment of this series of quick posts talks about element selectors. If you cannot use jQuery, you can replace the popular dollar $(element) function with:
If you need to select a collection of elements there are two main methods:
document.getElementsByClassName('class_name'); //or document.querySelectorAll('div.class_name');
Last one is a more recent implementation, as MDC defines:
Returns a list of the elements within the document (using depth-first pre-order traversal of the document’s nodes) that match the specified group of selectors.