1
With that error code
<script>
$(function () {
$('[data-toggle="popover"]').popover({
html:true,
animation: true,
sanitize: false
})
})
var slide_old = "slide_img0";
var slide = "efeito_slide";
$('#carouselExampleCaptions').on('slide.bs.carousel', function (ev) {
var id = ev.to;
switch (id) {
case 0:
$("." + slide_old).removeClass( slide )
$(".slide_img0").addClass( slide );
slide_old = "slide_img0";
break;
case 1:
$("." + slide_old).removeClass( slide )
$(".slide_img1").addClass( slide );
slide_old = "slide_img1";
break;
case 2:
$("." + slide_old).removeClass( slide )
$(".slide_img2").addClass( slide );
slide_old = "slide_img2";
break;
case 3:
$("." + slide_old).removeClass( slide )
$(".slide_img3").addClass( slide );
slide_old = "slide_img3";
break;
default:
break;
}
})
But not this
<script>
jQuery(function () {
jQuery('[data-toggle="popover"]').popover({
html:true,
animation: true,
sanitize: false
})
})
var slide_old = "slide_img0";
var slide = "efeito_slide";
jQuery('#carouselExampleCaptions').on('slide.bs.carousel', function (ev) {
var id = ev.to;
switch (id) {
case 0:
jQuery("." + slide_old).removeClass( slide )
jQuery(".slide_img0").addClass( slide );
slide_old = "slide_img0";
break;
case 1:
jQuery("." + slide_old).removeClass( slide )
jQuery(".slide_img1").addClass( slide );
slide_old = "slide_img1";
break;
case 2:
jQuery("." + slide_old).removeClass( slide )
jQuery(".slide_img2").addClass( slide );
slide_old = "slide_img2";
break;
case 3:
jQuery("." + slide_old).removeClass( slide )
jQuery(".slide_img3").addClass( slide );
slide_old = "slide_img3";
break;
default:
break;
}
})
</script>
'Cause you’re making a mistake 'Cause it was just working perfectly?
can explain better? what should the code do? where is it using it?
– Gustavo André Richter
Check in your browser console what the variable
$
contains. Some code is probably overwriting this variable.– Andre
As @user140828 mentioned, some other code must have overwritten the "$" alias, you recently added some js library to your project? By the way, just to leave the note here, many people do not know, but the "$" is just a nickname for jQuery, could be anything else that is not reserved by javascript or is being used, and is configurable tb
– Ricardo Pontual
@Gustavorichter Richter this code is to be able to place html in a Popover and place and remove a class according to an image exchange slide
– Douglas Dourado
@user140828 returns this on the Uncaught Typeerror console: $ is not a Function at (index):524
– Douglas Dourado