Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > $ is not defined with jquery.maplights.js View modes: 
User avatar
Member
Member
kevin.clark-gaprc - 3/21/2011 3:11:58 PM
   
$ is not defined with jquery.maplights.js
I'm trying to implement what appears to be a simple jquery. However, when I add my user control to a page in Kentico I get the error of "$ is not defined". At first I thought the js source mapping was incorrect but that doesn't seem to be the case. The script folder is in the root directory of where the user control is located. I'm pretty new to Kentico, so I'm sure the resolution is simple, but at the moment I cannot figure this out.

Thanks in advance!

script type="text/javascript" src="RohlWebParts_Scripts/jquery.maphilight.js"></script>
<script type="text/javascript" src="RohlWebParts_Scripts/jquery.maphilight.min.js"></script>

<script type="text/javascript" language="JavaScript">

$(function () {
$('.map').maphilight({ fillColor: ' #00FFFF', fillOpacity: '0.6', strokeColor: '#FFFFFF' });
});
function notification(e) {

document.getElementById('shoutbox').innerHTML = e;
}
</script>

User avatar
Member
Member
kentico_michal - 3/22/2011 8:00:16 AM
   
RE:$ is not defined with jquery.maplights.js
Hi,

When you get the $ is not defined error, it’s almost always because the jquery.js file has not been included or your reference to it is pointing to the wrong location.
So please make sure you have done that, and make sure that it is before all your other jquery code in the HTML.

Moreover, are you using any other javascript library on your page except jQuery? If so, could you please try to modify your custom script and use noConflict parameter to avoid problems with using jQuery alongside another javascript library.


Best regards,
Michal Legen