I have some DIVs with IDs like 'abc_chosen', 'danger_chosen', etc.
I would like to delete all DIVs when their IDs contain the string '_chosen'.
How can I do that?
I have some DIVs with IDs like 'abc_chosen', 'danger_chosen', etc.
I would like to delete all DIVs when their IDs contain the string '_chosen'.
How can I do that?
Try this:
$('div[id$="_chosen"]').remove();
$
here will check if _chosen
is at the end of id
.
Thanks to @evolutionxbox:
If you want to check if id contain _chosen
anywhere(not at the end)
$('[id*="_chosen"]').remove();