Is there a right way to run javascript confirm() when Remove button is pressed ?
I tried the following but it won't bind the click event. Nothing happens.

Drupal.behaviors.mymoduleConfirmRemoval = function(context) {
  $('input.form-submit', context).bind('click', myconfirmFunc );

It, however, does bind with mousedown event but mousedown ignores my_confirm()'s return value.

Any insight would be appreciated.


Title:How to run javascript: confirm() when Remove button is pressed ?confirm() dialog when Remove button is pressed ?

Priority:Major» Normal

Yes please, I've lost count of the number of times I've pressed the Remove button, thinking it is a Save button. When I have an image, Description field, Title Field, and extended Caption field, it is a lot of text (and image) to lose in a single click.

Hi guys, I probably won't be adding this directly to FileField, since this module is no longer receiving features. It should be possible to implement via an add-on module.

As @drudrew noted in the original posting, you can bind an additional handler to the mousedown() event. Then you can use to prevent the triggering of further handlers.