Trying to consolidate jQuery code <p>I have loads of code that most need to be loaded BEFORE the other piece of code in order for it to work correctly. In order for me to achieve this I have multiple scripts over and over again. Is there a way I can clean some of this up? I will try and give examples:</p> <pre><code>//This needs to load first to add class &lt;script&gt; $(function(){ if (typeof(global_Current_ProductCode) !="undefined") { if ($('#pt494').length == 0 ) { $('font[class="text colors_text"]:eq(0)').closest('table').addClass('thePrices'); } } }); &lt;/script&gt; //This needs to load 2nd because it has to add the class first before it does this &lt;script&gt; $(function(){ if (typeof(global_Current_ProductCode) !="undefined") { if ($('#pt490').length == 0 ) { $('table[class="thePrices"]:eq(0)').closest('table').before($('font[class="productnamecolorLARGE colors_productname"]:eq(0)').addClass('toptitle'));} } }); &lt;/script&gt; </code></pre> <p>There is so much more code similar to this, there has got to be a way to throw it all under the same IF statement?</p>