We're Moving to a New Support Platform – Starting June 1st!

We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.

You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.

While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.

We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.

Thanks for your continued support and trust – we’re excited to bring you an even better support experience!

Okay
  Public Ticket #937647
jQuery Selector of wpDatatables
Closed

Comments

  •  2
    lennartwittmann started the conversation

    Hi support team,

    I have got a link column in my table. How can I capture a click on that link by jQuery? 

    I tried several thinks, but even the most general jQuery("a").click gets triggered when clicking any link within the table.

    I even added a class element in the <a> links in class.link.wpdatacolumn.php. So a link would print out <a class="wpdatatable" href="http://www.google,de">Link</a> and removed the target=_blank to remain in the current window.

    But no change either with jQuery(".wpdatatables").

    How can I select links in a wpdatatable by jQuery?

    Thanks a lot!

    Regards, Lennart


  • [deleted] replied

    Hi Lennart,
    Thank you for your purchase.

    If I understand correctly you want to click on a link and get that link with jQuery. E.g. cell data is www.google.com||Google and you want to get just www.google.com?

  •  2
    lennartwittmann replied

    Hi Milos,

    yes I want to process the href value of that link by some external jQuery/AJAX script. In order to do that I need to capture the click on a link within wpdatatables, e. g.

    jQuery('.wpdatatables').click(function(e) { ... // do something });

    But no matter what I define the click event will not get fired. Seems like the click already gets consumed by another script. 

    Question is: which jQuery-selector gets me the click on a link column within wpdatatables?


    BR Lennart


  • [deleted] replied

    Hi Lennart,

    You can use this code as example how to get href attribute from table:

    jQuery(window).load(function() {
        jQuery("#table_1").on('click', 'td > a', function() {
            var link = jQuery(this).attr('href');
            alert(link);
        }).DataTable();
    });
    
  •  2
    lennartwittmann replied

    WOW it worked! Thank your very much, Milos!

    You should published that on your homepage: Accessing table with external jQuery script!

    Thanks (again)!

    Lennart

  • [deleted] replied

    Hi Lennart,

    You are welcome. We'd greatly appreciate it if you could take a minute and leave a review on CodeCanyon on this link. Thanks!