简体   繁体   中英

BootBox - Unexpected identifier error

Im wondering if someone could help me out with a bit of code.

Im using BootBox for some Modal windows, i want to add some custom HTML to the confirm method, but i dont think im doing it right.

My code is below:

    $('.next').click(function (event) {
       event.preventDefault();
       var href = $(this).attr('href');
       bootbox.confirm({

            message: "I am a testing message",
            title: "Please confirm you have enrolled"

            callback: function (result) {
                if (result) {
                    location.href = href;
                }               
            }

       });
    });

The error im getting is as follows:

Uncaught SyntaxError: Unexpected identifier 

Any help would be greatly appreciated.

Cheers,

You have a syntax error here:

Your original code

title: "Please confirm you have enrolled"
callback: function (result) {
   if (result) {
      location.href = href;
   }               
}

New code

title: "Please confirm you have enrolled",
callback: function (result) {
   if (result) {
      location.href = href;
   }               
}

Note the "," character at the end of the title line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM