-2

I want to do such a thing

<input type="text"  value="<a href="abc.html"><img src="abc.jpg"></a>">

but not appearance this (

<a href="abc.html"><img src="abc.jpg"></a>

) code as text. plz help me.

tymeJV
  • 103,943
  • 14
  • 161
  • 157
user3083648
  • 9
  • 1
  • 1
  • 3
  • What language are you using? C#/ASP.NET? PHP? Something else? – mayabelle Dec 09 '13 at 16:46
  • Right, but I was asking what was in your codebehind. Most languages have an escape formatting function you can apply, to avoid the manual escaping approaches described below. – mayabelle Dec 09 '13 at 16:47
  • Exemple of @Quentin solution with [HTML encoding](http://htmlentities.net/) compared to Barmar in this [fiddle](http://jsfiddle.net/r5F37/) – Lan Dec 09 '13 at 16:58

3 Answers3

0

For an attribute value that is delimited by " characters to contain a " character as data, it must be represented by a character reference: &quot;

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
-1

You should use :

<input type='image' src='/path/to/img.jpg'>

Codepen

jshawl
  • 3,315
  • 2
  • 22
  • 34
  • That would change the page from having the value as editable text into one that has a picture of the default text as a submit button. – Quentin Dec 09 '13 at 16:49
-2

Use different types of quotes for the inner quoting:

<input type="text"  value="<a href='abc.html'><img src='abc.jpg'></a>">
Barmar
  • 741,623
  • 53
  • 500
  • 612