I have a form where I am uploading images, so there is obviously an input[type=file] which has a class of .image-upload,but as it looks ugly I have hidden it (display: none) and instead have a pretty button that says upload (class .upload) and on tap I want to trigger the tap/click event for the input[type=file] element so that the user can then upload an image.
The code below works on a desktop, but not on a mobile device. If I change the .click to .tap below then it works nowhere?
$(document).bind('pageshow', function() {
$('.ui-page-active .upload').tap(function() {
$('.ui-page-active .image-upload').click();
return false;
});
});
Update, I never thought that it could be a browser specific issue, but this code works in the stock Android browser, and not in Opera.
With jQuerymobile, you're better off using virtual events like
vclick. Giving something along the lines of