console.log在Google Chrome中使用时出现问题.突然,当我输出像$(this)这样的元素时显示如下:
[<div>, context: <div>]
Run Code Online (Sandbox Code Playgroud)
要么
[jQuery.fn.jQuery.init[1]]
Run Code Online (Sandbox Code Playgroud)
在控制台中.(两个来自同一行:console.log($(this)))
昨天出现了这个问题.代码没有问题.我在另一台计算机上记录完全相同的东西,它显示如下:
[<div class='element'></div>, ...]
Run Code Online (Sandbox Code Playgroud)
更新:新的Chrome版本会更改输出console.log()
有谁知道我如何回到谷歌Chrome控制台的原始设置?
我正在尝试使用socket.io学习nodejs,目前我正在使用GianlucaGuarini的这个教程.输入我的client.html文件时,出现以下错误.我知道这意味着什么,这是为了防止跨浏览器脚本,但我不知道如何允许我的nodejs脚本访问client.html文件.
XMLHttpRequest cannot load http://localhost:8000/socket.io/?EIO=3&transport=polling&t=1422653081432-10. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
这是我的socket代码的一部分.
var app = require('http').createServer(handler),
io = require('socket.io').listen(app),
fs = require('fs'),
mysql = require('mysql'),
connectionsArray = [],
connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '',
database: 'database',
port: 3306
}),
POLLING_INTERVAL = 3000,
pollingTimer;
// If there is an error connecting to the database
connection.connect(function(err) {
// connected! (unless `err` is set)
console.log(err);
});
// creating …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用元素的宽度element.outerWidth.当我使用Chrome时,它返回一个正确的值,但是当我切换到Firefox时,我得到了一个更低的值.firefox以什么方式读取这个与chrome不同的元素?
元件:
<div class="submit_container">
<input type="submit" value="Something" />
</div>
Run Code Online (Sandbox Code Playgroud)
Chrome:88px
Firefox:36px
当我使用firefox检查元素时,它显示与chrome中相同的元素.(88px)
我有一个看起来像这样的字符串:
"T E S T R E N T A L A K T I E B O L A G"
Run Code Online (Sandbox Code Playgroud)
我希望它看起来像这样:
"TEST RENTAL AKTIEBOLAG"
Run Code Online (Sandbox Code Playgroud)
但我似乎无法为我的问题找到正确的正则表达式.我想删除每个字符之间的一个空格.
亲切的问候/ H.