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:
//This needs to load first to add class
<script>
$(function(){
if (typeof(global_Current_ProductCode) !="undefined")
{
if ($('#pt494').length == 0 )
{ $('font[class="text colors_text"]:eq(0)').closest('table').addClass('thePrices'); }
}
});
</script>
//This needs to load 2nd because it has to add the class first before it does this
<script>
$(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'));}
}
});
</script>
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?