1
How to send the src value of an img tag to the value of a text field?
<script>
// Inicia o Clipboard no elemento "button"
function teste() {
alert("t");
var src = $("#imagem").attr("src");
alert(src);
}
</script>
<!-- Código com suas imagens! -->
<div class="col-xs-10 col-offset-2">
<div class="col-xs-5">
<img src="aoi1.jpg" id="imagem" class="img-thumbnail" alt="Cinque Terre" width="100%">
<input type="button" class="btn btn-block btn-primary" onclick="teste();" value="TESTE">
<input type="text" value="" id="button"/>
</div>
</div>
Just use
$("#button").val( src )
aftervar src = ...
– Valdeir Psr
That one
id=button
is a bit monkey XD. I advise to change the name of the element.– lazyFox