You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xshop/resources/views/segments/comments/SimpleComments/SimpleComments.js

13 lines
550 B
JavaScript

document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.comment-reply')?.forEach(function (el) {
el.addEventListener('click', function () {
const id = this.getAttribute('data-id');
document.querySelector('#parent_id').value = id;
document.querySelectorAll('.simple-single-comment')?.forEach(function (el2) {
el2.classList.remove('on-reply');
});
el.closest('.simple-single-comment').classList.add('on-reply')
});
})
});