JQUERY: Uncaught Error: Syntax error, unrecognized expression
console.log($('"#'+d+'"'));
in html i have
<div id="2013-10-23">
<h1>5</h1>
<p>eeeeeeeeeeee</p>
</div>
It throws error:
Uncaught Error: Syntax error, unrecognized expression: "#2013-10-23"
In above code i have one div with id="2013-10-23"
and when getting that id in response it is throwing syntax error
try
console.log($("#"+d));
your solution is passing the double quotes as part of the string.
The "double quote" + 'single quote' combo is not needed
console.log( $('#'+d) ); // single quotes only
console.log( $("#"+d) ); // double quotes only
Your selector results like this, which is overkill with the quotes:
$('"#abc"') // -> it'll try to find <div id='"#abc"'>
// In css, this would be the equivalent:
"#abc"{ /* Wrong */ } // instead of:
#abc{ /* Right */ }
Try using:
console.log($("#"+d));
This will remove the extra quotes you were using.
链接地址: http://www.djcxy.com/p/87990.html上一篇: 地图的结果列表是一个更长的时间