When I am calling "postscribe" then it's showing that:
Cannot set property 'postscribe' of null.
My code is
$(document).on('click', '.btn', function () {
google_ad_client = "pub-9999999999999999";
google_ad_slot = "9999999999";
google_ad_width = 300;
google_ad_height = 250;
postscribe('#adv1', '<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"><\\/script>');
})
Can anyone help?
this error means that the element (
#adv1
) you gave to postscribe does not exist in the DOM at the time your script was run.Before running your script, first add the
#adv1
to the DOM. You could do something like this: