首页 > Web开发 > 详细

node-webkit File Dialog

时间:2015-05-29 13:42:25      阅读:213      评论:0      收藏:0      [点我收藏+]

1. 多次选择相同的路径时,chooser.onchange 事件不触发

参考链接

Choosing the same directory multiple times

Once the chooser has been used to select a directory (or the same file path + file name), the change event will not fire again since the value of the input is already set with the same value. For example, if a user is expected to select a directory to export a file to, if they choose the same directory multiple times, the change event will one fire once. This is only an issue if the selected value may potentially be the same multiple times, i.e. in the case of selecting an output directory.

In this case, re-setting the value of the input can ensure that the change event will always fire in subsequent selections.

jQuery

<script>
  function chooseFile(name) {
    var chooser = $(name);
    chooser.change(function(evt) {
      console.log($(this).val());
      // Reset the selected value to empty (‘‘)
      $(this).val(‘);
    });

    chooser.trigger(‘click‘);  
  }
  chooseFile(‘#fileDialog‘);
</script>

 

node-webkit File Dialog

原文:http://www.cnblogs.com/JosephLiao/p/4538165.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!