Loop through selected elements with jQuery

There may be times when you need to loop through elements in jQuery to collect information, change state or some other nifty trick that can’t be done easily using jQuery’s various selection etc functions. This post has an example of looping through elements with jQuery by getting all the href attributes from the <a> tags of a selected element.

Force reload of updated CSS and Javascript files with unique filenames

When a CSS or Javascript file is changed the visitor’s browser needs to get the latest copy of the file to reflect the changes, but it will have been cached and may cause rendering or functionality issues depending on the changes. To force reloading of the CSS and Javascript file the files should be renamed each time they are changed; this can be automated by using PHP to add the timestamp of the file into the filename.

Get the total number of matched elements with jQuery

There may be times when you need to work out how many times a particular element appears on a page or within a section with Javascript and this is easy to do with jQuery using the length property. Using the method in this post you can also work out if an element exists on the page with jQuery.