HTML File input JS events

后端 未结 3 1364
南笙
南笙 2021-02-04 02:24

Are there any JavaScript events in type=file input? I.E. I would like to add an extra file input upon selecting file in one of allready created:

<
3条回答
  •  一个人的身影
    2021-02-04 02:59

    Here is the event logged by Firebug when selecting a file with Firebug:

    • click clientX=885, clientY=207
    • blur
    • focus
    • change
    • DOMActivate
    • DOMActivate
    • mouseout clientX=162, clientY=27

    I guess change, is the one you are looking for:

    $ ('#your_form_id input[type=file]').live ('change', function () {
      $(this).parent ().append ($(''));
    })
    

    you just have to adapt the selector and the previous code should work

提交回复
热议问题