Last Updated: July 05, 2017
·
957
· gesposito

JavaScript and jQuery Snippets

jQuery

$(function() {
    // Handler for .ready() called.
    // Shorthand version
});

(function ($) {
    // Immediately Invoked Function Expression
    // passing jQuery to avoid conflict
})(jQuery);

;(function ( $, window, document, undefined ) {
    // Immediately Invoked Function Expression
    // passing parameters for jQuery Plugins
    // https://github.com/jquery-boilerplate/jquery-boilerplate/blob/master/src/jquery.boilerplate.js
})( jQuery, window, document );

JavaScript

(function(){
    // Immediately Invoked Function Expression
    // Vanilla JavaScript equivalent
}());

// Dynamically load JavaScript files
function loadScript(source, callback) {
    if (!source) return;

    var el = document.createElement('script');
    el.type = 'text/javascript';
    el.src = source;
    el.onload = callback || console.log('Loaded');
    document.body.appendChild(el);
}

2 Responses
Add your response

Hi, I'm a beginner in JavaScript but i want to launch a web up and i need help. Can JavaScript collect data input from a user and send to my email address automatically in a word format if so can you show me???

over 1 year ago ·

Hi, I'm a beginner in JavaScript but i want to launch a web up and i need help. Can JavaScript collect data input from a user and send to my email address automatically in a word format if so can you show me???

over 1 year ago ·