最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Clear console with command - Stack Overflow

programmeradmin3浏览0评论

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.

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.

Share Improve this question asked May 4, 2016 at 8:29 Gaurav AggarwalGaurav Aggarwal 10.2k8 gold badges41 silver badges76 bronze badges 1
  • Solution in stackoverflow.com/questions/3011600/… – Akash Amin Commented May 4, 2016 at 8:38
Add a comment  | 

4 Answers 4

Reset to default 7

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

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

You can use either below commands

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

OR

CTRL + L as Shortcut to clear Developer Console.

A common convention for all browsers is

clear()

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

console.clear()
发布评论

评论列表(0)

  1. 暂无评论