<div id="div1">
<form name="scanner" action="" method="post">
<label style ="margin-top:0px; font-size:50px;"for="barcodescan">Scan Barcode</label>
<input name="picture" type="file" id="barcodescan" accept="image/*;capture=camera">
</form>
</div>
<div id="div1">
<form name="scanner" id="scannerForm" action="" method="post">
<label style ="margin-top:0px; font-size:50px;"for="barcodescan">Scan Barcode</label>
<input name="picture" type="file" id="barcodescan" accept="image/*;capture=camera">
</form>
</div>
<script>
document.getElementById("barcodescan").onchange = function() {
if( this.files.length != 0 ) {
document.getElementById("scannerForm").submit();
}
else {
alert("no barcode picked, please try again!");
}
}
</script>