I got this error in Firefox: TypeError: $(“#main-CNTR”).on is not a function.
And this code doesn’t work at all:
$(document).ready(function(){
$('#main-CNTR').on('mouseenter','.social_span',function(){
alert("INSIDE");
});
$('#main-CNTR').on('mouseleave','.social_span',function(){
alert("OUTSIDE");
});
});
The HTML part is this
<span class="social_span"></span>
<div class="row clearfix" style="display:none;">
<ul class="social-buttons cf">
<li>1</li>
</ul>
</div>
On mouse entering the span a message should be displayed and the next div shown. Obviously the div#main-CNTR is the main content container div and the HTML snippet is repeated several time in the page.
The live method correctly works but not in ie8.
$('.social_span').live('mouseenter',function(){
alert("INSIDE");
});
$('.social_span + .row').live('mouseleave',function(){
alert("OUTSIDE");
});
Can anyone help me? Thanks!
<script type="text/javascript" src="/js/libs/modernizr-2.5.3.min.js"></script>
<script type="text/javascript" src="/js/jQuery/engine/core8.js"></script>
<script type="text/javascript" src="/js/jQuery/engine/ui.js"></script>
<script type="text/javascript" src="/js/jQuery/plugin/jquery.tools.min.js"></script>
<script type="text/javascript" src="/js/jQuery/plugin/jquery.easing.js"></script>
<script type="text/javascript" src="/js/jQuery/plugin/jquery.lavalamp.min.js"></script>
<script type="text/javascript" src="/js/jQuery/plugin/jquery.fancybox.js"></script>
<script type="text/javascript" src="/js/jQuery/plugin/jquery.li-scroller.js"></script>
<script type="text/javascript" src="/js/jQuery/plugin/jquery.reflection.js"></script>
<script type="text/javascript" src="/js/jQuery/plugin/jquery.jcarousel.min.js"></script>
<script type="text/javascript" src="/js/jQuery/plugin/jquery.selectbox.js"></script>
The
.on()function was added in jQuery 1.7, so you’ll need to make sure you’re using that version or higher in order to use.on(). From the error you’re getting that doesn’t appear to be the case.