Open a link in a cell by clicking anywhere on that cell's row


/ Published in: jQuery
Save to your folder(s)

This code was use for openning a pdf file that was in a table cell. This link was the only link/button for each rows. Using this, you can click anywhere on each rows to open it's link page.


Copy this code and paste it in your HTML
  1. $("tr.TrClassName").click(function(){
  2. newURL = $(this).children("td.tdClassName").children("a").attr("href");
  3. //window.open.location.href = newURL; // Choose one: Open in the same page
  4. window.open(newURL); // Choose one: Open in a new page
  5. return false; // Stops the click that is over the link to open 2 different copies of the same linked page.
  6. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.