Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1159937

    I’m trying to open an alert box when someone clicks the remove button.
    No mather what I try my js is not fireing when you click the ‘x’.
    How can i call my js before removing an element?

    $(document).on('click', '.avia_sortable_element.av_drag.ui-draggable .avia-delete', function (e) {
            var confirmBox = confirm('Weet je zeker dat je dit element wilt verwijderen');
            if (confirmBox) {
                console.log( $(e.target).attr('title') );
            } else {
                e.preventDefault();
                return false;
            }
        } );
    • This topic was modified 5 years, 1 month ago by draadnijkerk.
    #1160096

    Hey draadnijkerk,

    Try changing $ to jQuery

    Best regards,
    Jordan Shannon

    #1160223

    That can’t be it already defined it this way.
    I always work with $.
    The problem is the event in not fireing no mather what I try.
    You function to remove the element runs before and returns false.
    There is now no way that my code will be seen by the browser.

    When i put the code in avia-builder.js it works, only problem is that
    I can’t update the theme after I do this.

    • This reply was modified 5 years, 1 month ago by draadnijkerk.
    #1160821

    Hi,

    Try to add the code to footer or header wit the following:

    
    function add_this_script_footer(){ ?>
    
    [YOUR JS CODE HERE]
    
    <?php } 
    
    add_action('wp_footer', 'add_this_script_footer');

    And let us know if this would work out for you.

    Best regards,
    Basilis

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.