Answer the question
In order to leave comments, you need to log in
How to replace a div with another div?
Hello. Here I am sending data by socket that a new client has arrived with a div, indicated id (each client has its own).
client.broadcast.emit('clientNew', {clientNew : '<div id=' + clientId + '>Пришел новый Вася!</div>'});
io.sockets.emit('clientNew', {clientNew : '<div id=' + clientId + '>Вася уплыл!</div>'});
Answer the question
In order to leave comments, you need to log in
So why do you need to replace the div? Change the id of the div and its html
$('#id1').attr('id','id2')
$('#id2').html('Новый контент внутри дива')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question