event.target.id help

Hi Wix Community,
I’m hoping you can help me out. my current situation is that i’m trying to create a function that catches the element’s id when an event happens. the problem is that in the wix $w.event provides a syntax that i’m having some difficulty implementing.
what i want to do is get the element’s id when the onclick event happens, add that id to a variable to be able to manipulate the element at a later time, in order to test that the code is working currently, I’m populating the string of the variable into a pTag but when i call the function from the button it does not seem to work. the code is below:

function popsum()
{

//let fname = ‘Steve’;
//$w(‘#firstnameSummary’).text = fname;

let indsel = event.target.id;
$w(‘#firstnameSummary’).text = indsel;

}

export function review_onClick(event, $w)
{

showreview(); 

popsum();

}

when i populate the variable with the string it displays in my p tag, when i try to get the element id i get an error. would anyone be able to give me some direction on what i’m missing?
the end game is to capture the id of several checkboxes when they’re clicked, and to add their label to a variable for later as well. we want to create a function that we can triggered instead of manually coding each checkbox to take action as the amount of checkboxes is a bit high. any direction will be greatly appreciated, kind regards and thank you.

Hi,
You need to pass the event argument to popsum and to add it at the function it self.
Roi.