Trigger a click event on an inner element

前端 未结 14 624
后悔当初
后悔当初 2020-12-29 07:53

A row in a table where each first cell contains a link needs to be clicked and open a url.

14条回答
  •  执念已碎
    2020-12-29 08:20

    try

    $('table tr').click(function() {
      var href = $(this).find("a").attr("href");
        if(href) {
           window.location = href;
        }
    });
    

提交回复
热议问题