You're likely looking for a solution that gets a div containing or adjacent to your button, or a child of an adjacent element. I'd suggest something along these lines:
(Some alternatives notwithstanding depending on your particular use-case. e.g. innerText vs textContent or parentNode vs parentElement, and target vs currentTarget.)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You're likely looking for a solution that gets a
div
containing or adjacent to your button, or a child of an adjacent element. I'd suggest something along these lines:With the JS along these lines:
(Some alternatives notwithstanding depending on your particular use-case. e.g.
innerText
vstextContent
orparentNode
vsparentElement
, andtarget
vscurrentTarget
.)