Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Free Nodelet gets templating features (', " and \)

by ikegami (Pope)
on Dec 07, 2006 at 02:22 UTC ( #588245=note: print w/replies, xml ) Need Help??


in reply to Free Nodelet gets templating features

Oddly enough for templating features destined to be used in JavaScript, there's no modifier to interpolate a variable (say `title`) as a JavaScript literal.

For example, neither

var title = '`title`'; # Fails for titles containing ' or \.

nor

var title = "`title`"; # Fails for titles containing " or \.

work for all titles. The workaround:

var title = decodeURIComponent('`title%`');

Update: tye suggested `title"` in a later post.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://588245]
help
Chatterbox?
[Cow1337killr]: Welcome, Kanvee.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2017-02-23 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (338 votes). Check out past polls.