Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#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:
Blocked by: Blocking:

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 (6)

comment:1 Changed 5 years ago by rwaldron

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

comment:2 Changed 5 years ago by rwaldron

  • Component changed from unfiled to event
  • Milestone changed from None to 1.6.3
  • Priority changed from undecided to low
  • Resolution set to worksforme
  • Status changed from new to closed

comment:3 follow-up: Changed 5 years 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 5 years 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>

comment:5 Changed 5 years ago by a.porrua@…

If the form has display:none; chrome doesn't show the dialog, but if the form has not display:none; chrome does.

It is a chrome thing thought.

The problem is that unpespected behaivour brokes the jquery's cross-browserality.

comment:6 Changed 5 years ago by dmethvin

  • Milestone 1.6.3 deleted
Note: See TracTickets for help on using tickets.