Trigger click on data-wysihtml5-dialog-action="save" #60

Closed
ejholmes opened this Issue May 10, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Contributor

ejholmes commented May 10, 2012

What's the proper way to trigger a save on a dialog via JavaScript? I've tried something like:

$('[data-wysihtml5-dialog-action="save"]').trigger('click');

But it doesn't cause the dialog to save.

@tiff tiff closed this May 10, 2012

@tiff tiff reopened this May 10, 2012

Collaborator

tiff commented May 10, 2012

That's not working like that since jQuery can't trigger events that itself didn't attach.

You'll need to write your own triggerEvent function (or you just copy the one from QUnit which should work perfectly in all browsers: https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L634).

There's currently no better way to save and close the dialog. Sorry for that.

Contributor

ejholmes commented May 10, 2012

Didn't know that. Thanks for the response!

@tiff tiff closed this May 10, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment