Case with bootstrap:
Example code
function( $ ){
}( window.jQuery );
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s done so you can guarantee
$is actually jQuery within that function. Sometimes libraries will attempt to use the same symbol and conflicts can occur (e.g. Prototype and jQuery can both use$). This is particularly important in code that is widely distributed and may be used in many environments and configurations, like bootstrap.Using this idiom can also help prevent the introduction of unwanted variables into the global scope.