I have a nice [label] button that triggers a file upload window. The separate image uploading form/script itself is at the bottom of the page. The ugly default file upload button itself is hidden by CSS.
When I click the [label] button, the browser scrolls all the way to the bottom of the page where my hidden form and script stuff is located. How do I prevent this focusing or scrolling?
Here is how my code is set up. A nice upload button and interface for uploading images near the top of the page (inside "main" form). The actual image uploading form (separate form) at the bottom of the page:
<form name="main-form">
<div class="imagelist" id="imagelist">
<div class="uploadcontainer"><br><br>
<label for="imagefile" id="uploadbutton" class="btn btn-primary btn-lg">Upload Images</label>
</div>
</div>
... (other input fields, etc for main form, etc.)
</form>
.
.
.
.
all the way to the bottom of the page:
.
.
<form name="uploadform" id="uploadform" method="post" action="/edit-images/uploadimage.php" enctype="multipart/form-data">
<input type="hidden" name="itemimagesid" value="<?php echo $itemid; ?>" />
<input type="hidden" name="itemtype" value="new" />
<input type="file" name="imagefile" id="imagefile" onchange="uploadFile()">
</form>