这是我正在尝试开发的益智游戏的片段。each()
问题是它在调用 jquery后停止工作。请帮我找出问题所在。提前致谢。
function setTotalInPositionPieces()
{
$("#board").children('div').each(function(index, element) {
if(testInPosition(element))
{
++totalInPositionPieces;
$(element).attr("data-inPositionStatus", '1');
}
});
/* The script does not from here, onward. Please tell
me what is the problem.*/
if(totalInPositionPieces == totalPieces)
{
$("#messageBox").text("Puzzle Solved!");
}
}
totalInPositionPieces
并且totalPieces
是全局变量。