How to add a click event listener to a text field inside of a table?

I have 3 tables in my Kintone form.

The first table is used for lookup.

The second table has the field code TableA.

The third table has the field code TableB.

I want to add a click event listener to a text field with the field code mgr_checked that is inside of TableA.

How to get access to the table and add an event listener to the text field?

Hi annaylee,

This will be very similar to the past inquiry, “How to add click event listener for every newly added table row?” you have posted, and by adding your specific events to the target element using addEventListener, etc.

Looking back at the post, we suggested targeting all rows in the table, but this time it would be the column of the target field.

It will depend on where the column is and where it is placed within the table.

However, in terms of adding events, the basic code construction is the same as the previous one.

(function() {

"use strict";

var setfunction = function(event){

alert("click");

for(var n=1; n < document.getElementsByClassName('subtable-gaia')[0].rows.length; n++){

document.getElementsByClassName('subtable-gaia')[0].rows[n].removeEventListener('click', setfunction);

}

for(var m=1; m < document.getElementsByClassName('subtable-gaia')[0].rows.length; m++){

document.getElementsByClassName('subtable-gaia')[0].rows[m].addEventListener('click', setfunction);

}

}

kintone.events.on("app.record.edit.show", function(event) {

for(var i=1; i < document.getElementsByClassName('subtable-gaia')[0].rows.length; i++){

document.getElementsByClassName('subtable-gaia')[0].rows[i].addEventListener('click', setfunction);

}

});

})();

I hope this helps.