Why is console.log() not printing anything?

大兔子大兔子 提交于 2020-01-01 04:00:08

问题


Just getting started with Meteor, on Windows. Following the initial instructions, the automatically generated "Hello World" app is running on localhost. The text and button are there, but clicking it doesn't output anything to the console. However, replacing console.log() with alert() does show the text ("You pressed the button") in the pop-up window.


回答1:


the console.log() output is printed in the browser. but it gets cleared immediately if you are submitting a form or handling an event as the page automatically gets refreshed.

if you want it to work, 1.Use chrome browser 2. check "Preserve log" check box on the console. then you can see the log




回答2:


@dimfisch - I didn't see a console.log in your code snippet above. At any rate, I'm reiterating my comment as an answer:

Any console.log entries that are inside a Meteor.isServer block will by default NOT show up in the browser's console log. They'll show in the terminal from where you launched your app via the meteor command.




回答3:


Make sure you are looking at the right console. It might be your console is not logging the page you are testing. :) Happened to me.



来源:https://stackoverflow.com/questions/14346394/why-is-console-log-not-printing-anything

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!