Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need same functionality on div click as it is on Anchor #109

Closed
sunnykantkr opened this issue Jun 3, 2016 · 1 comment
Closed

Need same functionality on div click as it is on Anchor #109

sunnykantkr opened this issue Jun 3, 2016 · 1 comment

Comments

@sunnykantkr
Copy link

sunnykantkr commented Jun 3, 2016

I used jquery.dirtyforms with bootstrap modal to notify user that something is not saved in this page. This worked perfectly with anchor links. But, I have a DIV on page which is actually working as a link to some other page. DIV has data-action attribute containing URL of the other page and on DIV click I am setting the data-action value to window.location.href to navigate. When I clicked the DIV, it gave the confirmation message on default popup of browser instead of Bootstrap Modal.
I have given a unique class to div as tabDiv. I tried to add the support for DIV in Jquery.dirtyforms.js and witten this which did not work....thanks for the help :

var events = {
        bind: function (window, document, data) {
            $(window).bind('beforeunload', data, events.onBeforeUnload);
            $(document).on('click', 'a:not([target="_blank"])', data, events.onAnchorClick)
                       .on('submit', 'form', data, events.onSubmit)
                       .on('click', 'div.tabDiv', data, events.onDivCLick);
        },
       onDivCLick: function(ev){
             bindFn(ev);
        },
@NightOwl888
Copy link
Collaborator

Already answered in this answer. This answer and this answer may also be helpful.

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

No branches or pull requests

2 participants