0
I need to make a system to delete messages, these messages are placed inside div’s, where I divide like html just below. As in the check box there is a location for the click, I separated a div that will simulate the movement of a click, when clicking this div it should change its appearance, so that it is evident that that div is marked. At another precise moment a delete message button, which will scan the DOM behind Divs with the particular added class.
Example: I have DIV-A, inside there are several other Ivs including DIV-MARQUE, when clicking on this DIV-MARQUE, I need a class to be added to it, stating that it is "selected". When clicking on a BOOT-DELETE, I need a function that scans the page Divs behind the informed class.
So I need to summarize two coiasas
1° - When clicking on the DIV add a class 'x' to it.
2° - When clicking the "delete" button I need to get the ID’s located inside the div selected 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 I click on selectedMensagem
, he guard the id
, contained in the idMenssagem
and do what I described in the above message.
Thank you in advance.
Project Jsfiddle
Can you explain in other words what you explained in the first paragraph? It’s not very clear to me.
– Sergio
Even after your dit this sentence doesn’t make sense to me: "he add to this div a class
"selecionado"
right after virify which ones are in theDOM
asdivs
which contains this class."– Sergio
I made a project in Jsfiddle to better visualize. When the guy clicks on the div whose class is
selectedMensagem
he must add a new class to is div and search in the gift, for all div that has the class, (this serves for me to change the appearance of div, so that it looks like a select) After this, I need to get the ID, because all this, is for me to delete the selected messages. I could understand more ?– Renan Rodrigues
Do you want to click on a div that contains a Hidden inside? That’s what I’m reading in your code?
– RBoschini
Actually it is a select system, so that all that are selected I have ID and can delete.
– Renan Rodrigues
@Rboschini Yes, in him all the magic will happen.
– Renan Rodrigues
The principle is a CHECK BOX, which you can select several, and then you can check where there are checked box and delete them.
– Renan Rodrigues
puts onClick on that Hidden, for the user to click on it.
– RBoschini
But what I need is not onClick, because the click works, I need logic, how to do it !
– Renan Rodrigues
@Sergio Entendeu ?
– Renan Rodrigues
@Renanrodrigues to be honest no. It may be because I speak pt_PT. Review the first paragraph and try to clarify. I’m happy to help, but I need to understand the problem first.
– Sergio
@Sergio I tried to be as explanatory as I said think about the principle of
check box
adding the classchecked
at thecheck box
– Renan Rodrigues
@Renanrodrigues, if maybe it is better you leave for a custom checkbox, take a look at this link Quick Tip: Easy CSS3 Checkboxes and Radio Buttons
– Tobias Mesquita