Coder
Coder

Reputation: 253

String with double quotes inside input value in python

I want to display a string in input value. That string contain double quotes. I want to display it as it is. Its developed with Python

<input  id="answer" name="answer" type="text"  value="<%= element.answer %>" />

My string content is Testing "quotes" test

When its displayed in input field, it shows only Testing because of double quotes issue.

I have tried escape(element.answer) to display it. But it shows this result

Testing%20%22quotes%22%20test

I want to display the exact content. Pllease help

Upvotes: 0

Views: 750

Answers (1)

Coder
Coder

Reputation: 253

Thanks. Got solution for this problem

Instead of this <%= element.answer %>

I have changed it to <%- element.answer %>

It works fine now

Upvotes: 1

Related Questions