1

Is it possible to give "" symbol itself in the html text box tag?

My requirement is something like this:

<input name="myapi" id="testapi" type="text" value="{"value": "!MYAPI!sdfg" }" class="revapi" hidden="true"/>

where {"value": "!MYAPI!sdfg" } is the value of the text box

Is there any way to do so?

Mr_Green
  • 40,727
  • 45
  • 159
  • 271
Mithun Debnath
  • 588
  • 1
  • 8
  • 23
  • This looks like its well answered here: http://stackoverflow.com/a/4015380/490188 (How to properly escape quotes inside html attributes?) – Danny Staple Nov 06 '14 at 11:53

3 Answers3

1

Use HTML Entities. Here is the example

<input type = "text" value = "&quot;{&quot;value&quot;: &quot;!MYAPI!sdfg&quot;}&quot;">
sanjay Kumar
  • 140
  • 1
  • 14
1

Just wrap the value with ' (single quote) instead of " (double quotes)

<input name="myapi" id="testapi" type="text" value='{"value": "!MYAPI!sdfg" }' class="revapi"/>

Working Fiddle

Mr_Green
  • 40,727
  • 45
  • 159
  • 271
0

you can escape the "

<input name="myapi" id="testapi" type="text" value="{\"value\": \"!MYAPI!sdfg\" }" class="revapi" hidden="true"/>

or use ' instead of ""

<input name="myapi" id="testapi" type="text" value="{'value': '!MYAPI!sdfg' }" class="revapi" hidden="true"/>
Adrian B.
  • 1,592
  • 1
  • 20
  • 38