0
You can remove a class from a div with a ID
specific?
That one div
is dynamically inserted through the append
, and each receives its own ID
. Only there are times I need to remove only ONE div
which was inserted with append
, as they have the same class but not the same ID
, has something to do with?
For example:
$('.remove > id = 6').remove();
it is possible?
$("#6").remove()
does not resolve? How do you want to remove? By clicking a button?– fernandosavio
$("[id='6']").remove()
I was just about to write this... I didn’t quite understand another option– hugocsl
No... I’m gonna dynamically remove, along with the append.
– user135790
I get the id like this: Results.rows.item(i). id; how could I remove it like this? $(Results.rows.item(i).id). remove()?
– user135790
Not knowing what it is
results.rows
there’s no helping you.– fernandosavio
It is the result of my query in the database. Results.rows.item(i). id returns me id. So, I store it in a variable. var id = Results.rows.item(i). id;
– user135790
Since you have the identifier saved in a variable, consider the
#
with the handle and have it removed, try so:$('#' + id).remove();
– Pedro Paulo
@Pebble with the remove class would look something like this? $('.remove> #' + id). remove();
– user135790
It would be yes, but as @fernandosavio commented, there is no need to specify the class, because the identifier is unique (at least it should be) and already works to find the element.
– Pedro Paulo
He wants to remove only the id that contains the remove class, so he will have to do a each in the remove class and remove the ids inside the loop
– Gabriel Carneiro