Skip to main content

Bug Tracker

Side navigation

#9954 closed bug (worksforme)

Opened August 01, 2011 04:27PM UTC

Closed August 01, 2011 04:51PM UTC

Last modified August 26, 2011 01:56AM UTC

jquery does not trigger default events in chrome

Reported by: a.porrua@gmail.com 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();

});

Attachments (0)
Change History (6)

Changed August 01, 2011 04:50PM UTC by rwaldron comment:1

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

Changed August 01, 2011 04:51PM UTC by rwaldron comment:2

component: unfiledevent
milestone: None1.6.3
priority: undecidedlow
resolution: → worksforme
status: newclosed

Changed August 01, 2011 04:57PM UTC by ajpiano comment:3

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

Changed August 02, 2011 11:25AM UTC by anonymous comment:4

Replying to [comment:3 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>

Changed August 03, 2011 11:33AM UTC by a.porrua@gmail.com comment:5

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.

Changed August 26, 2011 01:56AM UTC by dmethvin comment:6

milestone: 1.6.3