jQuery JavaScript Code Snippets

This overview is handy towards stepping back and forth between jQuery and JavaScript. First line is jQuery and the following line is the corresponding function in JavaScript. jQuery $(document).ready(function() { // code… }); JavaScript document.addEventListener(“DOMContentLoaded”, function() { // code… }); jQuery var divs = $(“div”); JavaScript var divs = document.querySelectorAll(“div”); jQuery var newDiv = $(“<div/>”);

Read More

Eclipse complains about jquery minified JS files

When using minified files in Eclipse it can caused errors when there shouldn’t be any. Eclipse complains when using jquery.min.js files. One solution is to ignore the specific file. Go to : Project->Properties->JavaScript->Include Path->Source-> Excluded Groups ignore specific files by adding a suitable exclusion pattern e.g. **/jquery*.js Solution found at bug report 349020 comment 15 via stackoverflow topic ignore

Read More

SourceCode Compressor

When optimizing it can be a good idea to compress (also called minification) your files by removing all unnecessary characters from source code. There are several website which can easily help with that: HTML Compressor JavaScript Compressor CSS Compressor