Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing URL in textbox as html \

Status
Not open for further replies.

phpserge

Programmer
May 24, 2012
2
US
I'm having trouble printing a URL in a textbox form element:

Code:
	<script>
	$(function() {
		$('#introphoto').click(function() { 		
			var areaValue = $('#messagebox').val();
			$('#messagebox').val(areaValue + 'View my <a href="#">Book</a>');
		});
	});
	</script>

the text is actually printing out: View my <a href="#">Book</a> instead of typing out a link.
 
Textboxes do not render html. They simply show the raw text.

Why would you want a link in an editable textbox? What happens if a user decides to change it?

What exactly are you trying to do?

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Its an ajax chat. I'm trying to pass a link in the window that prints the output of the 2 people chatting. I'm able to insert emoticons as gifs so it's reading html.. but not rendering href tags..
 
I'm having trouble printing a URL in a textbox form element

There is no such form element type as "textbox". If you mean <textarea>, then the the clue is in the name as to the data type it holds: text.

I'm able to insert emoticons as gifs

For this reason, I suspect you're not actually dealing with a form element at the rendering side. You may well use a form element to store the underlying markup used in the rendering, but you do not see images in a <textarea>.

Hope this helps,

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[blue]@[/blue] Code Couch:
[blue]@[/blue] Twitter:
 
As Dan mentions, text areas like text boxes do not render HTML.

If you are using something that renders HTML then it's likely a composite element that parses the code and renders in a div. but it is not a regular text element.

If you are using some type of chat GUI then you'd need to look at its rendering code, it simply may not be programmed to parse links.

Withou knowing what chat code you are using there really isn't much more we can say.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top