$(document).ready(function() { $(".popup").fancybox(fancyboxoptions("ajax")); $(".popup.iframe").fancybox(fancyboxoptions("iframe")); $(".popup-image").fancybox(fancyboxoptions("photo")); $(".datatable.clickable tr td").bind("click", function(e) { var $clicked = $(e.target); if (!$clicked.closest("a").get(0)){ var $this = $(this).closest("tr"); console.log($this.find("a.rowaction")); $this.find("a.rowaction:first").click(); console.log($this.find("a.rowaction:first").html()) } }) $(".deletebtn").click(function(){ return confirm("Are you sure you want to delete this record?"); }) }); var transitionSpeed = 300; function fancyboxoptions(type) { if (type) { var fancybox_popup = { 'type' : type, 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', //'modal' : true, 'scrolling' : 'no', 'autoDimensions': false, 'autoScale' : false, 'centerOnScroll': true, 'titleShow' : true, 'titleFormat' : function(titleStr, currentArray, currentIndex, currentOpts) { //+ $(currentOpts.orig).attr("class") var $this = currentOpts.orig; var $title = currentOpts.orig.next(".link-title").html(); if (!$title) { $title = currentOpts.orig.attr("title"); } return '