top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What is wrong with this code line "$('#myid.3').text('blah blah!!!');"

+5 votes
What is wrong with this code line "$('#myid.3').text('blah blah!!!');"
posted Jul 14, 2015 by Shivaranjini

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote

The problem with above statement is that the selectors is having meta characters and to use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \. For example, an element with id="", can use the selector $("#foo\.bar").
So the correct syntax is,

$('#myid\.3').text('blah blah!!!');

answer Jul 21, 2015 by Karthick.c
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.