Visual Builder

Get Involved. Join the Conversation.


    Himanshu Sethi
    I am using oj-dialog box , on close (x) icon I want...Answered
    Topic posted November 1, 2019 by Himanshu SethiBlue Ribbon: 750+ Points 
    18 Views, 6 Comments
    I am using oj-dialog box , on close (x) icon I want to trigger an event but I am not able to capture the class or id of close(x) icon.

    PFB the oj-dialog code


    <oj-dialog style="display:none" id="modalDialog1" dialog-title="Modal Dialog">
                  <div slot="body">
                    The dialog window can be moved, resized and closed with the 'x' icon.
                    Arbitrary content can be added to the the body and footer sections.
                  <div slot="footer">
                    <oj-button id="okButton" on-oj-action="[[close]]">OK

    I want to link custom event for close icon , class:oj-dialog-header-close-wrapper , but not sure why the binding is not possible on internal classes and id's of oj-dialog box.

    I am using below code to link.


    $( ".oj-dialog-header-close-wrapper" ).bind( "click", function() {

      alert( "User clicked on 'foo.'" );


    But alert is not happeing.

    Please let me know the root cause of this problem and solution how to link an event on click of close icon.

    Best Comment

    Duncan Mills

    You use the ojClose or ojBeforeClose event on the dialog - this way any manner that closes the dialog will run the same code