javascriptdom-eventsuservoice

UserVoice widget close button event override


I want to be able to modify or add to the onclick of the a href tag for a UserVoice widget.

This code is generated for me.

<a title="Close Dialog" id="uservoice-dialog-close" onclick="UserVoice.Dialog.close(); return false;" href="#close"><span style="display: none;">Close Dialog</span></a>

I want to call what is there but add my own method when clicking close. I do not or do not want to modify the source that generates this code but rather add to it upon document ready.


Solution

  • jQuery to the rescue.

    This works:

    $("#uservoice-dialog-close").live("click", function() {
        DoFunction();
    });
    

    I was trying:

    $("#uservoice-dialog-close").bind("click", function() {
        DoFunction();
    });