Clear console with command

强颜欢笑 提交于 2019-12-07 02:46:24

问题


Like this is my console currently with lots of line in it

Is there any javascript or jquery command with which i can clear the console.

I don't want to hit clear button with mouse. Only a code command is required.


回答1:


Try this:

console.clear();

You can use this code in your scripts. Read more about console.

Note that in Google Chrome, console.clear() has no effect if the user has selected "Preserve log upon navigation" in the settings.

Update: As noticed @evolutionxbox you can use just clear() to do that. You'll get the same result.

You can also clear console in the web browsers with keyboard shortcuts: CTRL + L

Clear console in Firebug: ALT + R




回答2:


A common convention for all browsers is

clear()

for chrome and some other webkit based browsers you can also use

console.clear()



回答3:


You can use console.clear(), at least in Chrome.




回答4:


You can use either below commands

 clear()
 console.clear()
 window.clear()

OR

CTRL + L as Shortcut to clear Developer Console.



来源:https://stackoverflow.com/questions/37022369/clear-console-with-command

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