son Posted October 25, 2011 Share Posted October 25, 2011 I have placed links inside a textarea, so user can right-click and easily copy/paste code. It does not validate and complains there should not be <a /> element in textarea. What could I do instead? Son Link to comment Share on other sites More sharing options...
~The Coder~ Posted October 25, 2011 Share Posted October 25, 2011 I have placed links inside a textarea, so user can right-click and easily copy/paste code. It does not validate and complains there should not be <a /> element in textarea. What could I do instead? Son Well from reading your post you said "It does not validate and complains there should not be <a /> element in textarea." If you wrote your post correctly, then the browser is right, it shouldn't be their. Instead it should be written with a:</a> Don't put the "/" after the "a" put it before. Your link should look like <a href:"http://www.example.com">Example</a> Link to comment Share on other sites More sharing options...
Ingolme Posted October 25, 2011 Share Posted October 25, 2011 Well from reading your post you said "It does not validate and complains there should not be <a /> element in textarea." If you wrote your post correctly, then the browser is right, it shouldn't be their. Instead it should be written with a:</a> Don't put the "/" after the "a" put it before. Your link should look like <a href:"http://www.example.com">Example</a> "<a />" is just a shorthand representation for the full element with attributes and content. A textarea cannot contain HTML elements inside it, you can encode them with entities: <a />But maybe what you wanted was an actual link inside the textarea box. That's not possible. The textarea is only meant to have plain text in it. Link to comment Share on other sites More sharing options...
~The Coder~ Posted October 25, 2011 Share Posted October 25, 2011 "<a />" is just a shorthand representation for the full element with attributes and content. Oh ok thank you for explaining:) Link to comment Share on other sites More sharing options...
son Posted October 25, 2011 Author Share Posted October 25, 2011 Used the entities version which is fine as I only want an easy way for users to grab code that can be inserted into their own pages... Cheers,Son Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.