Trigger Close File Browse window pop-up?

1.3k views Asked by At

Is it possible to close the window that is opened by the click of an input file type using jquery/javascript ?

I have :

$("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 Part :

<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>

I am using backbone framework and the templating is done using twitter bootstrap(The template is a paid one).

This is to prevent it from triggering a second time. I am facing this issue in firefox(windows) alone. Click of input type is triggering the browse window twice.

0

There are 0 answers