我想找到一些div类,并在类2之后添加一个代码。
更新
在编写另一个代码而不是google广告代码时,它可以正常工作。
<script>
$(function()
{
var say = $('.panel-footer.clearfix').length;
if(say >= 3){
$('.panel-footer.clearfix')[1].after('<script async
src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline-block;width:320px;height:100px"
data-ad-client="ca-pub-3767785488130692"
data-ad-slot="3213073317"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>');
}
});
但没用。代码运行在页面的底部,而不是第二个div。