JavaScript How to browse the img src javascript browser javascript,browser javascript console,browser javascript support,browser javascript

Here is what i need to do. So i have this code

 <input type="file" id="uploadImage" name="image" />
    <input type="submit" id="ImageName" name="submit" value="Submit">

So when i click the "Choose.." button to browse an image, i want the path of that image to be saved in a variable.

Or basically what i need to do is to make this path to be src of an image.

$('#Imageholder').append('<img src="" class="ImgCoords" >');

Any ideas?

Sorry if the explanation is bad :

Answer:1

Here is an example that i have made , adapt it to your need :

DEMO HERE

I added a button remove uploaded file,if you don't like show/hide effect just delete slow , Image is shown only on upload:

$('#blah').hide();
$('#remove').hide();  
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]);
        }
    }

    $("#imgInp").change(function(){
        if( $('#imgInp').val()!=""){

            $('#remove').show();
            $('#blah').show('slow');
      }
        else{ $('#remove').hide();$('#blah').hide('slow');}
        readURL(this);
    });


    $('#remove').click(function(){
          $('#imgInp').val('');
          $(this).hide();
          $('#blah').hide('slow');
          $('#blah').attr('src','http://upload.wikimedia.org/wikipedia/commons/thumb/4/40/No_pub.svg/150px-No_pub.svg.png');
});

HTML Code:

<form id="form1">
    <input type='file' id="imgInp" name='image'/>
    <img id="blah" src="#" alt="your image" />
</form>
Answer:2

I don't know javascript and I have been searching every where for this answer. I would like to duplicate content in my page. The html and content comes directly from a broker. The result wanted is : ...

I don't know javascript and I have been searching every where for this answer. I would like to duplicate content in my page. The html and content comes directly from a broker. The result wanted is : ...

  1. document.getelementbyid duplicate id

I have a polymer input field like this: <paper-input type="text" class="user-value" data-id="user-value" value="{{typingAns}}" focus maxlength="10" /> is it possible to block the backspace ...

I have a polymer input field like this: <paper-input type="text" class="user-value" data-id="user-value" value="{{typingAns}}" focus maxlength="10" /> is it possible to block the backspace ...

I am working on a page where I need to have some similar trees (kind of) and leaves on them and have lots of them, as in like spanning across page width at page bottom. I was thinking of doing it 2 ...

I am working on a page where I need to have some similar trees (kind of) and leaves on them and have lots of them, as in like spanning across page width at page bottom. I was thinking of doing it 2 ...

  1. html create large text box
  2. html create large text

I have a survey web app at work to collect data from customers. I'm trying to convert a dozen different functions (one for each option) into one simple function. The "votes" are stored as ...

I have a survey web app at work to collect data from customers. I'm trying to convert a dozen different functions (one for each option) into one simple function. The "votes" are stored as ...

  1. passing value from html to python
  2. passing value from child to parent angular
  3. passing value from one input to another
  4. passing value from groovy script to request
  5. passing value from python flask to html
  6. passing value from child to parent react
  7. passing value from html to python django
  8. passing value from javascript to php
  9. passing value from controller to view
  10. passing value from adapter to fragment
  11. passing value from activity to fragment
  12. passing value from controller to view in mvc
  13. passing value from javascript to html
  14. passing value from flask to html
  15. passing value from child to parent vue
  16. passing value from javascript to jsp
  17. passing value from servlet to jsp
  18. passing value from js to html
  19. passing value from form2 to form1 c#
  20. passing value from one html to another