This can be done using Javascript. I don’t know what your degree of knowledge is with Javascript but I’m the kind of guy who likes to explain piece by piece :D
jQuery
$('a').click(function () {
$('input').attr('value', $(this).text());
});
The above code creates an event of the type click in all tags <a>
of the page (I don’t really recommend it, because the right one would be you create a ID for anchors from which content will be added to the attribute value
tag <input>
).
When the user clicks on the anchor, the event will search for all page inputs and add the attribute value
corresponding to the value of $(this)
anchor.
HTML
<body>
<a href="#">Valor1</a>
<a href="#">Valor2</a>
<input type="text">
</body>
I don’t want to be a pain in the ass about this, but you tagged me <input>
out of <body>
That’s not good practice.
If you want take a look at this link https://jsfiddle.net/iszwnc/1s1t6sko/ to see the code above running.
Update
I made this modification using Classes. Why? Well I imagine you want to get the value of an anchor group right? Using ID you violate a unitary concept (let’s say so).
How so unitary?
To ID is a type of single selector, which cannot be repeated from your statement, in other words if you define a ID to the Value 1 you will not be able to repeat it on Value 2.
That’s where the Classes, with this dial you can repeat endlessly at different times tags without violating such a concept.
Recalling that this term "unitary" is not explicitly documented by W3C, I only used it for teaching purposes.
This link is in the same domain as the page or is in another domain?
– Sergio
in the same domain... will be within the same folder including!
– Felipe
Just to make sure what you want: do you want to upload the contents of a file or the value of the link only? and that you want to put inside an input or another part of the page?
– Sergio