I need to make a system to delete messages, these messages are placed inside div's, where I divide like the html below. As in check box there is a place for the click, I separated a div that will simulate the movement of a click, when clicking on this div it should change its appearance, so that it becomes evident that that div is marked. At another time I need a button to delete message, which will scan the DOM behind divs with the given class added.
Example: I have the DIV-A, inside it has several other divs including DIV-MARQUE, when clicking on this DIV-MARQUE, I need a class to be added to it, stating that it is "selected". When I click on a BOTA-DELETE, I need a function that sweeps the DIVs of the page behind the informed class.
I need then summarizing two coiasas
1 ° - When you click on the DIV add an 'x' class to it.
2nd - Clicking the "delete" button takes the ID's located inside the selected div with class 'x'
Below my dynamically mounted HTML:
+' <div> '
+' <div class="selectedMensagem">'
+' <input class="idMenssagem" hidden="hidden" value="'+ ponteiro.COD_IDENT_COMUN +'" /> '
+' </div>'
+' <div class="emails mensagemEnviadaBorder">'
+' <input class="idMenssagem" hidden="hidden" value="'+ ponteiro.COD_IDENT_COMUN +'" />'
+' <div class="idEmails mensagemEnviada">' + letrasEmail(pointer.TXT_NOMEX_PESSO) + '</div> '
+' <div class="origemEmails">' + pointer.TXT_NOMEX_PESSO + '</div> '
+' <div class="dataeHoraEmails">' + inverteData(ponteiro.DAT_ENVIO_COMUN, 'data') + '</div>'
+' <div class="flagEmails">Enviado</div>'
+' <div class="assuntoEmails">' + ponteiro.TXT_ASSUN_COMUN + '</div>'
+' </div>'
+' </div>';
The idea is for me to click on selectedMensagem
, it will save id
, contained in idMenssagem
and do what I described in the above message.
Thank you in advance.
Project JSFiddle