$(document).ready( function () { $.MyBlah = function(blah) { alert(blah); }; MyBlah("Hello this works") // Inside the anonymous function we are cool. }); $.MyBlah("Oops") //This throws a JavaScript error (MyBlah is not a function)