node-webkit File Dialog

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>

 

转载于:https://www.cnblogs.com/JosephLiao/p/4538165.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值