diff --git a/lib/zin/wg/thinktableinput/js/v1.js b/lib/zin/wg/thinktableinput/js/v1.js index fe9fc4325a..789a8f5e1b 100644 --- a/lib/zin/wg/thinktableinput/js/v1.js +++ b/lib/zin/wg/thinktableinput/js/v1.js @@ -34,8 +34,8 @@ function setLineIndex() window.addRow = function(e) { if($('.rows-group').length >= canAddRows) return; - var parentFormGroup = $(e.target || e).closest('.form-group'); - var $newRow = $('.rows-template').clone(); + const parentFormGroup = $(e.target || e).closest('.form-group'); + const $newRow = $('.rows-template').clone(); $newRow.find('.btn-add').attr('onclick', 'addRow(this)'); $newRow.removeClass('rows-template').removeClass('hidden').addClass('rows-group'); $newRow.find('textarea').val(''); @@ -44,11 +44,11 @@ window.addRow = function(e) setLineIndex(); } -$(document).bind('click', '.btn-delete', function() { +$(document).on('click', '.btn-delete', function() { zui.Modal.confirm({message: deleteTip}).then((res) => { if(res) { - var $row = $(this).closest('.form-group'); + const $row = $(this).closest('.form-group'); $row.remove(); if(canAddRows == 1) $('.add-rows').removeClass('disabled'); setLineIndex(); diff --git a/lib/zin/wg/thinktableinput/v1.php b/lib/zin/wg/thinktableinput/v1.php index 4a7d6f1326..4ab1afbe89 100644 --- a/lib/zin/wg/thinktableinput/v1.php +++ b/lib/zin/wg/thinktableinput/v1.php @@ -76,7 +76,7 @@ class thinkTableInput extends thinkQuestion ( 'plus', setClass('mr-1 btn-add ml-2 text-sm text-primary add-rows'), - bind::click('addRow'), + bind::click('addRow(event)'), set::title(sprintf($lang->thinkrun->addTips, $canAddRows)), ) : null, ) @@ -117,7 +117,7 @@ class thinkTableInput extends thinkQuestion ( 'plus', setClass('mr-1 btn-add ml-2 text-sm text-primary add-rows'), - bind::click('addRow'), + bind::click('addRow(event)'), set::title(sprintf($lang->thinkrun->addTips, $canAddRows)), ), icon @@ -159,7 +159,7 @@ class thinkTableInput extends thinkQuestion ( 'plus', setClass('mr-1 btn-add ml-2 text-sm text-primary add-rows'), - bind::click('addRow'), + bind::click('addRow(event)'), set::title(sprintf($lang->thinkrun->addTips, $canAddRows)), ), icon