PHP to HTML Text Field Printing Problem
Since forever I’ve been looking for a way to easily print my blog content from php inside a html text input field or textarea. The results has always been awful or awkward at best. For those who have been making admin pages their whole life would know this. Printing an escaped HTML character is easy, but printing it inside a textarea is another story. The root cause of this is because
<input type='text' /> and
<textarea></textarea> have different ways of displaying content.
$json which contains the JSON encoded string, and
$result which contains the string which will be echoed.
Using this method, I can just use jQuery’s
.val() method to fill any text input, regardless of it’s type.
That’s all. Hope this helps. Happy blogging!