I mean i want to use any symbol or glyphicon for uploading an image insted of using that so long input field. (For uploading a profile pic)
After clicking on that glyphicon i could choose an image from my computer. below is fiddle for choose an image but it uses input field which is so long.
I want to show that glyphicon on hover a mouse & on another image that is hovering on background image.
how can i do it.. please help..
I am using following code
HTML:-
<input type='file' />
<img id="myImg" src="#" alt="your image" />
js code:
$(function () {
$(":file").change(function () {
if (this.files && this.files[0]) {
var reader = new FileReader();
reader.onload = imageIsLoaded;
reader.readAsDataURL(this.files[0]);
}
});
});
function imageIsLoaded(e) {
$('#myImg').attr('src', e.target.result);
};
Any suggestion appreciated.. [1]: http://jsfiddle.net/vacidesign/ja0tyj0f/