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



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

Answer / chaitanya

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="foo.bar", can use the selector $("#foo\.bar").

So the correct syntax is,

Hide Copy Code

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

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More jQuery Interview Questions

What features of jquery, has been used in web applications?

0 Answers  


What are the approaches of extracting a query string with regular expressions?

0 Answers  


What does the jQuery migrate function do?

0 Answers  


How to create, read and delete cookies with jquery?

0 Answers  


How to get the style property of an element using ?

0 Answers  






What is .bind()? : jquery mobile

0 Answers  


Tell me how to check if number is numeric while using jquery 1.7+? : jquery mobile

0 Answers  


How can you delay document.ready until a variable is set?

0 Answers  


Can we call C# code behind using jQuery?

0 Answers  


Explain the script build up by jquery?

0 Answers  


What is jQuery code to select all links in first paragraph?

0 Answers  


How do you disable or enable a form element?

0 Answers  


Categories