Good evening, guys
Have this javascript function that loads a banner within the 'tesum' div, according to the amount of lines that the text has in the div, like those ADS videos advertising on news site. And another random banner at the beginning of the text inside the 'bdads_post' div. However, I give the following error when I use the jquery version library: link
Error: {"message": "Uncaught ReferenceError: $ is not defined", "filename": "stacksnippets.net/js" ;, "lineno": 15, "colno": 9}
Another version works fine, however, other features of my site stop working, such as the load more button at the bottom of the homepage. www.belmontediario.com.br
There is some kind of incompatibility with my code. Is there another way to do this?
Obedience for attention!
$(function(){
var banner = ["<img src='http://1.bp.blogspot.com/-iFFHRIIu-OQ/WeQhVKLaqZI/AAAAAAAAhRM/poHm7XyVpfoK2OE-bR-D21wQrMU1W5RzgCK4BGAYYCw/s1600/madferro.gif' alt=''>", "<img src='http://3.bp.blogspot.com/-B84mYgVTaQQ/Utfu9prTnnI/AAAAAAAABtM/KdTqQzNS2Ec/s1600/ducarmin.gif' width='300' alt=''>"];
var bannerPost = banner[Math.floor(Math.random() * banner.length)];
$("#bdads_post").append(new Array(1 + 1).join(bannerPost));
});
$(function(){
var newImage = document.createElement('p');
var img = document.createElement('div');
img.innerHTML = '<img src="http://3.bp.blogspot.com/-nCxwwr5kcUM/WM7z-Gqi2FI/AAAAAAAAd2g/e30MQRv-EoUDwDIsAZyzCa0VqoaSPd6PQCK4B/s1600/ph-turismo.gif"/>';newImage.appendChild(img);newImage.id='phtur';varimage=document.getElementById("tesum");
image.insertBefore(newImage, image.childNodes[26]);
});
$(function(){
$('#phtur').hide().delay(20000).slideToggle('slow');
$('#phtur').click(function(){
$("#phtur").slideToggle('slow');
});
});
<div id='tesum'>
<div id='bdads_post'></div>
<p>"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."</p>
<p>"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."</p>
<p>"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."</p>
</div>