From 8b9eb3f973f77c4b77a1db7a936e830adb89bf3f Mon Sep 17 00:00:00 2001 From: rootcoma Date: Sun, 1 Dec 2013 13:51:25 -0800 Subject: [PATCH] Adding modal-table js --- php/js/triviatime.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 php/js/triviatime.js diff --git a/php/js/triviatime.js b/php/js/triviatime.js new file mode 100644 index 0000000..4dccfaf --- /dev/null +++ b/php/js/triviatime.js @@ -0,0 +1,30 @@ +var createModalDiv = function() { + if($('#infoModal').length == 0) { + $('body').append('' + + ''); + } +}; +$(function() { + $(".modal-table > tbody > tr").click(function() { + createModalDiv(); + var headers = $(this).parent("tbody").parent("table").find('th'); + var values = $(this).children("td"); + var content = ''; + for(var i=0;i"; + content += "

" + values.eq(i).text() + "

"; + } + $('#infoModal > .modal-body').html(content); + $('#infoModal').modal('show'); + }); +}); \ No newline at end of file