"If i make a custom function my site uses a lot. i put it in a plugin. :) "
Why not fake a namespace instead? like if you had function toUpperCase() { //your custom "to upper case" code that //would conflict with JS's verion } simply saying var waseem = {}; waseem.toUpperCase = function() { //your custom "to upper case" code that //would no longerconflict with JS's verion } would solve the issue.... back on topic, i haven't seen anyone suggest that the original code $(function(){ function displayMessage(){ alert('hello world'); }; }); $(function(){ displayMessage(); }); be written like function displayMessage(){ alert('hello world'); }; $(function(){ displayMessage(); }); $(function(){ displayMessage(); } }); which makes a lot of sense, and is a super simple change