jquery/javascript を使用して、入力ファイルの種類をクリックして開いたウィンドウを閉じることはできますか?
私は持っている :
$("input[name=profileImage]").click(function(e){
if(e.handled!=true){
e.handled= true;
}else{
//Trigger close the pop-up or stop the file browse window from being shown
e.preventDefault();// Does not work
return false; //no change either
}
});
HTML 部分 :
<div class="control-group">
<label class="control-label" for="form-field-1">Featured Image</label>
<div class="controls span4">
<input type="file" class="profileImage" name="profileImage" id="id-input-file-1" />
<span class="help-button ace-popover" data-trigger="hover" data-placement="right" data-content="Image type should be jpg/png">?</span>
<span> Upload your photo here </span>
</div>
</div>
私は使用してbackbone framework
おり、テンプレートは使用して行われますtwitter bootstrap
(テンプレートは有料です)。
これは、2 回目のトリガーを防止するためです。この問題は、Firefox (Windows) だけで直面しています。入力タイプのクリックで、ブラウズ ウィンドウが 2 回トリガーされます。