I'm trying to attach a new behavior to a submit button that already has AHAH behavior attached to it. This is what I have. If I bind a 'mouseover' event, it works, so I know the selector is correct.
Is it possible that since the AHAH will return FALSE, that any further click events will be ignored? Is there a way to attach further behavior to a button other than the default AHAH behavior defined by Drupal?
Drupal.behaviors.mediaAhahHideBrowser = function (context) {
$('.media-browser-submit:not(.mediaAhahHideBrowser-processed)', context).addClass('mediaAhahHideBrowser-processed').bind('click', function () {
// Hide the button.
$(this).hide();
// Next replace the browser with a progress indicator.
// @TODO
});
};
Comments
Comment #1
aaron commentedComment #2
aaron commentedturns out that the docs at http://api.drupal.org/api/file/developer/topics/forms_api_reference.html... lie: the default ahah event for submit buttons is 'mousedown', not 'click'...
fixed now in anycase -- i set the ahah event to click (which makes more sense than mousedown, which falsely registers if you click and move your mouse away, and doesn't register a space bar event when the element has the focus).
Comment #4
girishmuraly commentedThanks a ton aaron, you saved me a lot of time wondering what was going on!
Comment #5
gaëlgWow, thanks ! Actually I add to change to "mousedown", because click did not work. Not easy to figure out !
Comment #6
vishun commented<3