我有一點JQuery爲響應式設計創建了一個移動菜單。我通過代碼嗅探器運行代碼,它告訴我「Inline control structures are not allowed
」。JQuery代碼語法問題? (「內聯控制結構不允許」)
的代碼有問題的區域是:
else {
$('#main-menu li').each(function() {
if ($(this).children('ul').length)
$(this).append('<span class="drop-down-toggle"><span class="drop-down-arrow"></span></span>');
});
...從上面的具體線路是:
if ($(this).children('ul').length)
我想谷歌搜索「jQuery的內嵌控制結構 「但沒有提出太多。
這裏有一個entire function的pastebin供參考。我猜測代碼可以改寫,但我沒有參考要更改的代碼。代碼實際上起作用,所以我不確定它本身是否必然是語法錯誤。
嗯,是的,它修復了它。好點,我現在看到了。謝謝! –