Insert same image several times through input file

Asked

Viewed 154 times

1

I’m setting up a school website, and I’m adopting a new resource. I created an input file for people to insert images and they, through a preview should trim in the respective frames below. But it only works with the first frame! does not fall on the other three.

This is the link you can see and understand: http://escolacem.com.br/painel/index-bilhete.php

My code is as follows:

Javascript:

<script type="text/javascript">
     function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();

            reader.onload = function (e) {
                $('#blah')
                    .attr('src', e.target.result)

            };

            reader.readAsDataURL(input.files[0]);
        }
    }
 </script>

HTML:

<input type='file' onchange="readURL(this);" /> <img id="blah" class="largura" />

How do I make the image appear more often in other frames?

  • How’s that area of the paintings? $('#blah')&#xA; .attr suggests only one element.

  • Voce is only taking the first file input.files[0] - recalling that the id of their img should be unique. then Voce could add blah as a class and select images by class blah

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.