Skip to content

Commit

Permalink
fix click handler for dismiss button (#134)
Browse files Browse the repository at this point in the history
Using an arrow function binds "this" to the outer scope instead of the
target element. Pass the event parameter and access the event's target
to fix the handler.

Fixes: 9aa9542
  • Loading branch information
stklcode committed Nov 12, 2023
1 parent 9a553e8 commit 1ef1a24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ jQuery(document).ready(($) => {
'</a></p>'
);

$('#av-dismiss-' + md5).click(() => {
$('#av-dismiss-' + md5).click((evt) => {
$.post(
ajaxurl,
{
action: 'get_ajax_response',
_ajax_nonce: avNonce,
_file_md5: $(this).attr('id').substring(11),
_file_md5: evt.target.id.substring(11),
_action_request: 'update_white_list',
},
(res) => {
Expand Down

0 comments on commit 1ef1a24

Please sign in to comment.