 <p>If 2 variables have the same name in the same scope they will clash, the latter definition will overwrite the former.</p> <p>If for some reason you cannot edit the variable names, you could wrap the entire blocks of code in separate, anonymous functions:</p> <pre><code>$(function(){.....}); </code></pre> <p>This will put the 2 vars in separate scopes as long as you define them with <code>var</code>, so they will not clash. This may cause issues if parts of your scripts need the vars from the other. </p>