Home javascript Quotes Screening

Quotes Screening

Author

Date

Category

From site I get the data that can contain double or single quotes. How to shield them. I send a request for example on https://gdata.youtube.com/feeds / API / VIDEOS / KWLSE-UUOYE? ALT = JSON & amp; v = 2

var name = data.entry.title. $ // = contains the name "Kirkorov need to sing in a mental hospital!" Zhirinovsky! 02.26.2013
innerhtml = '& lt; Input Type = "text" class = "reset" value = "' + name + '" / & gt;'

Answer 1, Authority 100%

str = '"hello" how are you?';
STR = STR.REPLACE (/ "/ G, '& amp; quot;');
HTML = '& LT; Input Type = "text" class = "reset" value = "' + str + '" / & gt;';
Document.Write (HTML);

Answer 2, Authority 50%

If the problem correctly understood, try this:

name = name.replace (/ "/ g, '\\"');

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions