$(function(){ setSearchCondition(); $("#dateSelectorDiv").datepicker({ format: "yyyy-mm-dd", language: "ko" }); }) $(document).on('click', '.contentTr', function (){ $(".contentCheckBox").prop('checked', false); const target = $(this).find(".contentCheckBox")[0]; target.checked = true; const selectedTab = $(".nav-tabs").find(".active")[0].id; if(selectedTab === "contentTab"){ getBoardContent(target.value); }else if(selectedTab === "logTab"){ getBoardLog(target.value); } }) $(document).on('click', '#contentTab', function (){ getBoardContent(getContentSeq()) }) $(document).on('click', '#logTab', function (){ getBoardLog(getContentSeq()) }) function getContentSeq(){ return $(".contentCheckBox:checked").val(); } function getBoardContent(contentSeq){ if(contentSeq !== undefined){ $.ajax({ url: '/board/selectBoardContent', data: {contentSeq: contentSeq}, type: 'GET', dataType:"html", success: function(html){ $("#boardDiv").empty().append(html) }, error:function(){ } }); } } function getBoardLog(contentSeq){ if(contentSeq !== undefined){ $.ajax({ url: '/board/selectBoardLog', data: {contentSeq: contentSeq}, type: 'GET', dataType:"html", success: function(html){ $("#boardDiv").empty().append(html) }, error:function(){ } }); } }