Why does JSLint say there is a missing semicolon in this jQuery?

Here are some JSLint results:

 1  finaffJS.module('custom_ribbon_buttons', ['jQuery'], function ($) {
 2      var my = {};
 3  
 4      my.insertLightBoxCloseDialog = function () {
 5          var url = $('#finaff-insert-lightbox-image-url').val();
 6          if (url) {
 7              var buttonHtml = '<a class="finaff-lightbox-link" href="' + encodeURI(url) + '"><div class="FinAff_View_Image_Button_Sprites FinAff_View_Image_Button">&#160;</div></a>';
 8              SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, buttonHtml);
 9          } else {
10              $('#finaff-insert-lightbox-image-url-flash').text('Need a URL');
11          }
12      }
13  
14      my.insertLightBoxClicked = function () {
    =^
    lint warning: missing semicolon

Where is the supposed missing semicolon?

Or why is JSLint confused?

Upvotes: 0

Views: 444

Answers (1)

Mario Araque
Mario Araque

Reputation: 4572

You miss semicolon in line 12:

 4      my.insertLightBoxCloseDialog = function () {
 5          var url = $('#finaff-insert-lightbox-image-url').val();
 6          if (url) {
 7              var buttonHtml = '<a class="finaff-lightbox-link" href="' + encodeURI(url) + '"><div class="FinAff_View_Image_Button_Sprites FinAff_View_Image_Button">&#160;</div></a>';
 8              SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, buttonHtml);
 9          } else {
10              $('#finaff-insert-lightbox-image-url-flash').text('Need a URL');
11          }
12      };

Take a look at the line 2, you are declaring a variable with a {}, and you put a semicolon. insertLightBoxCloseDialog also needs it, is the same.

Upvotes: 2

Related Questions