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
Something like $(‘input[name=’uploadNewImage’]’).attr(‘src’, image.toDataURL());
You should get the
src
attribute of theinput
element, since it should contain the URL that it displays:$('input[name='uploadNewImage']').attr('src', image.toDataURL());