Fog Juice Posted January 23, 2009 Share Posted January 23, 2009 Hey everyone, How can I display HTML within a text input when the HTML contains quotes? For example: <input type="text" value="<a href="website.com"><img src="pic.jpg" /></a>" /> See the code above but the quotes screw it up so the first quote beside website.com is interpreted as the escape quote from the value=. I want to display that entire chunk of html within the value so that people can highlight it and copy it. Quote Link to comment https://forums.phpfreaks.com/topic/142056-solved-displaying-html-within-text-input/ Share on other sites More sharing options...
rubing Posted January 23, 2009 Share Posted January 23, 2009 use single quotes in your html instead. Quote Link to comment https://forums.phpfreaks.com/topic/142056-solved-displaying-html-within-text-input/#findComment-743916 Share on other sites More sharing options...
Fog Juice Posted January 23, 2009 Author Share Posted January 23, 2009 use single quotes in your html instead. single quotes don't work properly in all browsers, but I found a solution. Encode the HTML, I converted the HTML with http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx Quote Link to comment https://forums.phpfreaks.com/topic/142056-solved-displaying-html-within-text-input/#findComment-743922 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.