javascript - Calling "Click()" method of an element returns undefined, although the element definitely exists -


i'm trying call click() method of file input specific id, function call returns undefined , basically, nothing happens. i've replicated situation here: http://jsfiddle.net/gkag2/

it's simple:

html

<input id="hiddenfileinput" type="file" multiple="multiple" accept="image/*" > 

javascript

document.getelementbyid('hiddenfileinput').click(); alert(document.getelementbyid('hiddenfileinput').click()); 

i try calling click() method on element, doesn't work. call alert() print function returns when it's called. returns "undefined." i'm doing wrong, exactly?

you can't emulate click on input type=file. it's forbidden. works inside onclick handler. user must click on open dialog.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -