我正在尝试检查文件名变量是否为空。我用
$.each(rows, function(rowIndex, row){
var fileName = $.trim(fields[0]).toLowerCase();
//will output fileName
console.log(fileName );
//out -1,5,3,15,15,5,5,6,7,-1,3,5,5
console.log(fileName.indexOf('.html'));
if(fileName.indexOf('.html') < 0 || window.location.href.toLowerCase().indexOf(fileName) < 0) //invalid or different file, skip this row
{
//if the filename is empty skip this loop and check next loop filename variable
return true;
}
//the above script is to check to see if the filename is empty.
var $element = $('#' + fileName );
//doesn't show anything at all.
console.log(fileName );
})
我的“if”语句之前的所有内容都会显示,但不会在它之后显示。
感谢您的帮助。