0

So i'm using socket.io and jquery in a node project. I created the document ready function async because i have to await some functions in there.

$(async() =>{
  let socket = io();
  await some function
  $(document).on('event','object',async() =>{
    await some other function
    $(this).html('blablabla');
  }
}

Thing is that $(this) won't point to the object that trigger the event.I'm getting

Uncaught (in promise) TypeError: Cannot read property 'createDocumentFragment' of null

I searched a bit some other awnsers dont help me at all.Any idea how to access the object inside the event? Thanks.

Alator
  • 497
  • 6
  • 23

0 Answers0