这是我的控制台,目前有很多行
是否有任何 javascript 或 jquery 命令可以用来清除控制台。
I don't want to hit clear button with mouse. Only a code command is required.
最佳答案
试试这个:
console.clear();
您可以在脚本中使用此代码。阅读更多关于 console 的信息.
Note that in Google Chrome, console.clear() has no effect if the user has selected "Preserve log upon navigation" in the settings.
更新:正如@evolutionxbox 所注意到的,您可以只使用clear()
来做到这一点。您会得到相同的结果。
您还可以使用键盘快捷键在 Web 浏览器中清除控制台: CTRL + L
在 Firebug 中清除控制台:ALT + R
关于javascript - 使用命令清除控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37022369/