I have a form with a managed_file field where I need to know when the upload button is clicked, and then perform an action. I decide to make it by attaching a behavior to my button but it also trigger when I click on the remove button. Here is my code:
Drupal.behaviors.mattButtons = {
attach: function (context) {
jQuery('input.form-submit', context).bind('mousedown', Drupal.matt.checkFile );
}
};
Drupal.matt = Drupal.matt || {
checkFile : function(){
console.log("Hello");
var url = jQuery('.file a').attr('href');
console.log(url);
}
};
Is there any way to only attch my behvior on the file upload button?