Reply
Tue 1 Nov, 2016 05:43 pm
I am using below code:
<label for="imageFileUpload" class="file-button new-gradient " tabindex="0">
<span>
<%=(string.Format("{0}", (UploadedFiles != null && UploadedFiles.Count > 0) ? "Add Documentation" : "Add Receipt" %>
</span>
<asp:FileUpload ID="imageFileUpload" runat="server" type="file" size="10" CssClass="file-upload visually-hidden"
onchange="PerformUpload();" ClientIDMode="Static" />
</label>
Java script code:
$(function() {
$("#imageFileUpload").on("keyup", function (event) {
if (event.keyCode === 13) {
$("input[type = 'file']").click();
}
});
});
I am able to set the focus on the button using tabIndex. When i use keyboard to access the button focus is present but the file browser is not opened. nothing happens when i hit enter from keyboard.
Could you please help me out. Thanks in advance.