Call Remove Button (File Upload) Programmatically using JavaScript How can I call the remove button of temporary uploaded file programmatically using JavaScript?



I want to clear the form fields when the condition changes. I've done all the form fields exept the temporary uploaded file.

Can I call the remove function? If yes, Where is it?
Easiest way to do is what @Molo mentioned in his comment. 

$('#element_id').trigger("click"); OR $('.element_class').trigger("click");
$('#element_id').trigger("mousedown"); OR $('.element_class').trigger("mousedown");


Or you could, reset the .html() of the upload element  

$('#'+id).html($('#'+id).html()); OR  $('.'+class).html($('.'+class).html());


JavaScript into Drupal can be done in various ways, you could reference your javaScript file in your theme's info file or you override the drupal_add_js function in template.php and add your JavaScript. 

For more Information on how to put JavaScript into Drupal see this or this and these (module or module) could also be handy. This article explains how to programmatically submit a form in Drupal. 

Here is a good tutorial, how to add your JavaScript to Drupal https://www.drupal.org/node/756722