JQuery-confirm $.alert is not a function

372 Views Asked by At

My code is getting this error:

$.alert is not a function

I use jQuery from a CDN and jquery-confirm to run code. The first $.alert after document.ready works fine, after Btnsend.click it does not work.

$(document).ready(function(e) {
  $.alert('Teste Jquery-confirm'); // works
  var unidade = "<?php print $unidade ?>";

  $('#btnsend').click(function() {
    $.alert('clicado'); // error
1

There are 1 best solutions below

11
Tech Spot On

use Javascript alert() function, so:

$(document).ready(function (e) {
    alert('Teste Jquery-confirm'); // works
    var unidade = "<?php print 'unidade'; ?>";

    $('#btnsend').click(function () {
        alert('clicado');