Reputation: 44
Who knows what this symbols \\
do in jquery selector ?
Thank You!
Full code:
$("#solr\\.queryInput").attr("value", "");
Upvotes: 0
Views: 1016
Reputation: 1443
If you are using meta-characters ( such as !"#$%&'()*+,./:;<=>?@[]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes.
In your case there must be any div/span with id solr.queryInput ( id="solr.queryInput"
)
Example
If id="foo.bar"
,then you should use $("#foo\\.bar")
not $("#foo.bar")
$("#foo.bar").css({"background":"red"});
$("#foo1\\.bar1").css({"background":"red"});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="foo.bar">
Hello World
</div>
<div id="foo1.bar1">
Hello World 1
</div>
Upvotes: 3