Ticket #9954 (closed bug: worksforme)
jquery does not trigger default events in chrome
| Reported by: | a.porrua@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | |
| Component: | event | Version: | 1.6.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
For instance, this code will show the file input dialog in firefox, but will not in chrome
html:
<input type="file" id="file" /> <span id="triger">click me</span>
javascrip:
$('#trigger').click(function(){
$('#file'].click();
});
Change History
comment:2 Changed 22 months ago by rwaldron
- Priority changed from undecided to low
- Resolution set to worksforme
- Status changed from new to closed
- Component changed from unfiled to event
- Milestone changed from None to 1.6.3
comment:3 follow-up: ↓ 4 Changed 22 months ago by ajpiano
You can't force the file dialog to open, at least not without some serious workarounds: http://stackoverflow.com/questions/210643/in-javascript-can-i-make-a-click-event-fire-programmatically-for-a-file-input-e
comment:4 in reply to: ↑ 3 Changed 22 months ago by anonymous
Replying to ajpiano:
You can't force the file dialog to open, at least not without some serious workarounds: http://stackoverflow.com/questions/210643/in-javascript-can-i-make-a-click-event-fire-programmatically-for-a-file-input-e
This code works for me either in firefox 5.0 as in chromium 12.0.742.112
<html> <body>
<input id="file" type="file"/> <a href="#" onClick="document.getElementById('file').click();">Click me</a>
</body> </html>
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

That code can't possibly work at all - there are several syntax errors.