[英]Why does JSLint say there is a missing semicolon in this jQuery?
這是一些JSLint結果:
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"> </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
所謂的缺少分號在哪里?
還是為什么JSLint感到困惑?
您會在第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"> </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 };
看一下第2行,您使用{}
聲明了一個變量,並放入了分號。 insertLightBoxCloseDialog
也需要它,是一樣的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.