我试着做以下几点:为什么console.log不能在.each里面工作?
$('.not-following').each(function(i, obj) {
console.log('test');
});
由于某种原因,它使上打印obj的,而不是测试。这是为什么?我试着here
我试着做以下几点:为什么console.log不能在.each里面工作?
$('.not-following').each(function(i, obj) {
console.log('test');
});
由于某种原因,它使上打印obj的,而不是测试。这是为什么?我试着here
它不打印的对象,而不是,你看到的是jQuery的(节点阵列)的.each()
函数返回。
console.log()
不起作用的原因是Twitter已经用空函数替换了该方法,因为console.log在生产中被认为是不好的做法。
如果您需要访问console.log
可以删除Twitter的开发人员通过调用写的“重写”的版本:
delete console.log
的将默认CONSOLE.LOG回到它的原始功能。
不错,带@apsillers评论并将其添加到您的答案。 ;) – epascarello
你指的是哪条评论? (编辑)对不起,我没有看到其他答案的评论。 – azz
@DerFlatulator:This one:http://stackoverflow.com/questions/19728824/why-is-console-log-not-working-inside-each#comment29311186_19728924 :-D –
很可能是因为您的选择器没有选择任何东西。 'console.log($('。not-following')。length)' –
你可以发布一个jsfiddle链接或其他东西,你的url dosent似乎可以工作 – neoeahit
并在这里发布你的HTML **。 – j08691