Trigger Press "Enter" when clicking a tag in IE 8


I create a widget in jQuery colorbox, it allows the user to upload a file. The method of use I observe:

I have an input tag c type='file'and a style c visibility:hidden, then I created two labels in which both the “for” attributes point to the input element of the file to load, which is styled as a button. therefore, when the user clicks on it, the browser opens a pop-up window for them.

This approach works for IE9, IE10. but it doesn’t work in IE8, clicking on a shortcut does not even seem to trigger a click event on an input element.

Please help me.

Thanks in advance

+4
source share
2

, :

1) for, id.

2) CSS display:none. width:0, height:0, margin:-10000px .., .

, IE8.

+3

:

$('label').on('click',function() {
    $('input').trigger('click');
}
0

Source: https://habr.com/ru/post/1535640/


All Articles