Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link inside of input tag

Tags:

html

xhtml

How to display a a href and a img src inside a input box (text box). ex: i want to display this inside a text box ( <input id=link )

<a href="http://www.mysite.com/link" target="_blank"><img src="http://www.mysite.com/img.jpg" border="0" alt="mysite.com"></a>

thanks in advance.

like image 276
maxlk Avatar asked Aug 05 '11 16:08

maxlk


People also ask

How do you put a link in an input tag?

The <input type="url"> defines a field for entering a URL. The input value is automatically validated before the form can be submitted. Tip: Always add the <label> tag for best accessibility practices!

Can you put Div inside input?

You can't place any element inside an input. An input does not contain any HTML. Show activity on this post. The way to do that is to put the input and the wanted div inside a wrapper div, which should look like the input - the wanted width, length of the input and should have border.

How do you create a link and use it as an input in HTML?

To make a hyperlink in an HTML page, use the <a> and </a> tags, which are the tags used to define the links. The <a> tag indicates where the hyperlink starts and the </a> tag indicates where it ends. Whatever text gets added inside these tags, will work as a hyperlink. Add the URL for the link in the <a href=” ”>.


1 Answers

Based on the comments, I would guess that you want an input field that has that HTML code as the default text. You must use character reference codes for quotes and less/greater than signs.

<input type="text" value="&lt;a href=&quot;http://www.mysite.com/link&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://www.mysite.com/img.jpg&quot; border=&quot;0&quot; alt=&quot;mysite.com&quot;&gt;&lt;/a&gt;" />

(By the way, you mentioned "like in Photobucket" -- you can just look at the site's HTML to see how they do it.)

like image 57
JJJ Avatar answered Oct 04 '22 12:10

JJJ