skip to Main Content

In my code, I am showing an image to the user by changing the src to


 $("#" + img_tag_id).attr('src', image.toDataURL());

how can I take the value of this file to input tag below:

HTML code:

   <input type="file" name="uploadNewImage">

I am using finecrop plugin

2

Answers


  1. Something like $(‘input[name=’uploadNewImage’]’).attr(‘src’, image.toDataURL());

    Login or Signup to reply.
  2. You should get the src attribute of the input element, since it should contain the URL that it displays:

    $('input[name='uploadNewImage']').attr('src', image.toDataURL());

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search