i'm adding new clients with socket messages AFTER domready. i want to expand them on hover.
read some answers here, but nothing works. i don't know why
i tried
socket.on('newStudentJoined', function studentJoined(msg) {
console.log(msg.student + ' joined the room');
$(document.createElement('div'))
.attr('class', 'studentIcon closed col-md-2 ' + msg.student)
.text(msg.student + ' 4r3 g345t g354 g54 ght65 g45t 3f4 f4 f4 534 g534')
.on('hover', function() {
console.log('hovering');
$(this).toggleClass('closed').toggleClass('open');
})
.appendTo('#joinedClients');
});
and
$('.studentIcon').on('hover', function() {
console.log('hovering');
$(this).toggleClass('closed').toggleClass('open');
});
but not even the "hovering" console log comes out. the selector is correct, if i log it, it highlights the exact element. to make sure:
<div id="joinedClients" class="row">
<div class="studentIcon closed col-md-2 test">test 4r3 g345t g354 g54 ght65 g45t 3f4 f4 f4 534 g534</div>
</div>
what's wrong here?