1
我試圖檢測3個div是否爲空,如果它們都有一些內容激活一個按鈕。使用jQuery檢測div中的內容
function checkContent()
{
if (!$.trim($('#Div1').html()).length && !$.trim($('#Div2').html()).length && !$.trim($('#Div3').html()).length)
{
console.log("Ready");
$('#nextbutton').prop("disabled", false);
}
else
{
console.log("Not Ready");
}
}
因此,我在Div1中添加了一些內容,並且控制檯讀取,未準備好。一些分區2還沒有準備好。第3格(現在應該準備好了),但仍然說沒有準備好。
不知道我在做什麼錯,有什麼想法?