Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery id selector not working when have . in ID [duplicate]

Tags:

jquery

php

My html code is as below.

<div id="chatbox_dipesh.parmar" class="chatbox">
  //html markup which is validated
</div>

in above code dipesh.parmar div added dynamically.

And i am accessing it using following code.

$("#chatbox_"+chatboxtitle).show();

where chatboxtitle is dipesh.parmar but its not selecting div.

Does . is not a valid for ID.?

My jQuery is loaded and its not conflicting with other library and also wrapped it into $(function(){ }).

Thanks.

like image 308
Dipesh Parmar Avatar asked Mar 12 '13 12:03

Dipesh Parmar


1 Answers

Escape the dot.

See this: Direction

like image 75
Rob Avatar answered Sep 28 '22 11:09

Rob