I have limited experience and need some assistance with resolving this particular issue. I am looking to create an image upload box that works when clicked on the input field. Thank you in advance.
function readURL(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function(e) { $('#picker') .attr('src', e.target.result); }; reader.readAsDataURL(input.files[0]); } }
img { max-width: 180px; } input[type=file] { padding: 0px; position: absolute; display: ; background: ; } .card-1 { width: 180px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); transition: all 0.3s cubic-bezier(.25, .8, .25, 1); } .card-1:hover { box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="card card-1"> <input type='file' onchange="readURL(this);" /> <img id="picker" src="http://placehold.it/180" alt="your image" /> </div>