if (window.File && window.FileList && window.FileReader) {
var filesInput = document.getElementById("mobile-picker");
if (filesInput) {
filesInput.addEventListener("change", function (event) {
var files = event.target.files; //FileList object
var output = document.getElementById("the-pledge");
for (var i = 0; i < files.length; i++) {
var file = files[i];
//Only pics
if (!file.type.match('image') || file.type.match('tif') || file.type.match('gif')) {
}
else {
$('.webcam-overlay').fadeOut(300);
$('#webcam').fadeOut(300, function () {
$('#image').show();
var str = $('#image').attr("src");
var n = str ? str.lastIndexOf(',') : 0;
var result = str.substring(n + 1);
//console.log(result);
$('#hdnImgSrc').val(result);
$('.take-a-photo').hide()
$('.confirm-photo').show()
})
var picReader = new FileReader();
picReader.addEventListener("load", function (event) {
var picFile = event.target;
var div = document.createElement("div");
$('#image').attr("src", picFile.result);
usersImage = picFile.result;
output.insertBefore(div, null);
});
//Read the image
picReader.readAsDataURL(file);
//
//send ajax call to log Step2.1 Happy With Photo
//step2 field...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.