<label for="input">Label</label><input type="file" id="input"/>
In Firefox 7 it is not possible to trigger the open file dialog by clicking on the label.
This SO question is very similar but that’s green checked with it’s a bug in FF. I’m looking for a workaround.
Any ideas?
thank you for this q&a… helped me out.
my variation of @marten-wikstrom’s solution:
notes
$(function() {...});) is unnecessary, in either solution.jQuery.fn.livetakes care of that in @marten-wikstrom’s case; explicitly binding todocumentdoes in my example.jQuery.fn.on… current recommended binding technique.added the
!== 'INPUT'check to ensure execution does not get caught in a loop here:(since the file field click will bubble back up to the label)
change
event.targetcheck toevent.currentTarget, allowing for initial click on the<em>in:controlattribute for cleaner, simpler, spec-base form field association.