How do you convert a paragraph of text to something that can be assigned to a javascript variable with django template tags?
eg.
var myVar = {{ my_bio }}
where my_bio is some long paragraph of text with new lines, and other characters.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
escapejstemplate tag was created for this purpose, you can have a look at the Django documentation for use cases and examples.Example:
You can, of course, check out the code itself!