PDA

View Full Version : onClick copy image url into input field and display image



thenextst
06-18-2013, 03:57 AM
I have a plugin that let you add text over an image. If you add the URL of the image into a field it loads the image on the left side and let you add some text over it..

what i really want is to display an image gallery so when i click over an image it will copy the source to into a field and loads the image automatically..

I'm getting the image source into input field when i click over the image with the script below but its not loading the image on the left side... I'm just getting the source but not loading the image on the left side...

This is the plugin www.chistesdominicanos.com/editordememe ... if you click the image of the guy with the bottle at the bottom of the page it will copy the image source into the URL field but its not loading the image on the left... If you do it manually Copy/Paste the URL its going to work... can you please tell me what im doing wrong?


<script type="text/javascript">
function clicked(address) {
document.getElementById('meme-image-url-0').value = address.src;
document.getElementById('meme-top-text-0').focus();
}

<form>
<label for="copy_img">Image</label>
<input type="text" name="meme-image-url-0" id="meme-image-url-0" />

</form>
<li><img src="http://www.iltlaugh.com/wp-content/uploads/2012/10/437273.jpg" onclick="clicked(this)"/></li>
</ul>