Primefaces 5
I have <input type="file" class="ui-fileupload-choose>
in code to upload the files. This input
-Tag is generated automatically from a PrimeFaces component <p:fileUpload>
.
I want to hide the button for input
element and use my own styled button for upload.
So this is the styled button.
<input type="button" onclick="$('#formId\\:uploaderId .ui-fileupload-choose input').click();">
This does function in FF, Chrome and IE9, 10, 11.
But in IE8 nothing happens in upload phase. The "choose file" dialog is shown. The generated input file
has JQuery change event. I believe that this event will not be called, because if I click on input file
button it goes in all browsers.
I've tried
<input type="button" onclick="$('#formId\\:uploaderId .ui-fileupload-choose input').click(); #formId\\:uploaderId ui-fileupload-choose input').trigger('change');">
but it doesn't help.
Also I've tried
$('#formId\\:uploaderId .ui-fileupload-choose input').change(function () {
// Cause the change() event
// to be fired in IE8 et. al.
//some checks against recursion.
alert("I'm in change");
$('#formId\\:uploaderId .ui-fileupload-choose input').change();
});
The function in change is called but it doesn't help either.
What can I do in this situation ?