{"id":6862,"date":"2014-05-07T18:33:58","date_gmt":"2014-05-07T18:33:58","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/07\/uncaught-typeerror-cannot-call-method-css-of-null-anonymous-function-joomla-1-5-collection-of-common-programming-errors\/"},"modified":"2014-05-07T18:33:58","modified_gmt":"2014-05-07T18:33:58","slug":"uncaught-typeerror-cannot-call-method-css-of-null-anonymous-function-joomla-1-5-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/07\/uncaught-typeerror-cannot-call-method-css-of-null-anonymous-function-joomla-1-5-collection-of-common-programming-errors\/","title":{"rendered":"Uncaught TypeError: Cannot call method &#39;css&#39; of null (anonymous function) &#8211; Joomla 1.5-Collection of common programming errors"},"content":{"rendered":"<p>On your spa website, the file <code>js\/cookielaw.js<\/code> is not called, indeed it is invoked by relative url and <code>\/spa\/js\/cookielaw.js<\/code> return a 404 error, so no code are loaded.<\/p>\n<p>On your other website (about cars), the url is absolute : <code>\/scc\/js\/cookielaw.js<\/code> so the script is loaded.<\/p>\n<p>The issue is that DOM is not ready when you call that script, so jQuery return the error.<\/p>\n<p>Try to change begin of script from :<\/p>\n<pre><code>\/\/ Cookie Law\n\/\/ -----------------------------------------------------------------------------\n\n$('html').css('padding-top','35px');\n$('.cookiedisclaimer').show();\n\n(function($) {\n    \/\/...\n<\/code><\/pre>\n<p>to<\/p>\n<pre><code>\/\/ Cookie Law\n\/\/ -----------------------------------------------------------------------------\n\n(function($) {\n\n    $('html').css('padding-top','35px');\n    $('.cookiedisclaimer').show();\n    \/\/...\n<\/code><\/pre>\n<p>It&#8217;s the easier and faster way to fix.<\/p>\n<p>A cleaner way is to start your script like that :<\/p>\n<pre><code>\/\/ Cookie Law\n\/\/ -----------------------------------------------------------------------------\n\n$(document).ready(function() {\n    $('html').css('padding-top','35px');\n    $('.cookiedisclaimer').show();\n}) ;\n\n(function($) {\n    \/\/...\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>On your spa website, the file js\/cookielaw.js is not called, indeed it is invoked by relative url and \/spa\/js\/cookielaw.js return a 404 error, so no code are loaded. On your other website (about cars), the url is absolute : \/scc\/js\/cookielaw.js so the script is loaded. The issue is that DOM is not ready when you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6862","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6862","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6862"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6862\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6862"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}