2017-02-09 61 views
1

對不起,我不能弄清楚什麼是怪異的語法錯誤,並且需要某人清除它的頭腦。得到未知的語法錯誤

這裏是源:

var getCloseIt = document.querySelectorAll(".closeIt"); 

    $(getCloseIt).click(function() { 
     var ImgElements = document.querySelector(".previews").getElementsByTagName("img"); 
     var i = 0; 

     for (i ; i < ImgElements.length; i++) { 
       if(ImgElements[i].src !== ""){ 
        document.querySelector(".previews").className += " previews-full"; 
       } 
       else{ 
        continue; 
       } 
      }​ //Getting "Invalid or unexpected token" for this curly br. 
    }); 

在此先感謝

回答

3

你有}後無效字符。你可以在這個小提琴中看到它:https://jsfiddle.net/r49fe1jr/

enter image description here

要解決此問題,只需刪除該字符。

+0

哈哈謝謝!我正在通過每個調試器運行它,但忽略了jsfiddle。 – Jousi

+0

那個角色是什麼?爲什麼它不顯示在編輯器中? –

+1

@SanchayKumar它的HTML中的字符實體是'​',它是一個unicode零寬度空間 - 因此爲什麼大多數編輯器不顯示它。 http://www.fileformat.info/info/unicode/char/200b/index.htm –