BigJobbies
BigJobbies

Reputation: 509

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,

Upvotes: 1

Views: 2939

Answers (1)

Kolban
Kolban

Reputation: 15266

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.

Upvotes: 4

Related Questions