当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Counting the number div loaded from external php file

问题描述:

I have two php files, child.php and parent.php. Child.php generates div. Now, the parent.php calls child.php to be loaded in <div id='divContainer'>. Now, I need to count the div inside the divContainer. Is it possible?

I tried something like this:

$(document).ready(function () {

var total_record = $('#divContainer > div').length;

alert(total_record);

});

But it's not working. Even an empty alert is not popping out.

Can someone here, help me on this? THank you!

网友答案:

There's a syntax error:

)};

Should be:

});

Often if you are not getting any output/result at all when expected, it is down to a syntax error which will cause the browser to be unable to parse and execute the code. For future debugging, use the error console as this normally points out any errors with a decent description of the problem.

分享给朋友:
您可能感兴趣的文章:
随机阅读: