1
I need to know the amount of Ivs that contain a specific class, I thought I’d search all the css I have on Ivs, so I’ll eliminate until I find the Ivs with "has-error", only I can’t find out who exactly has the "has-error" class"
How to do?
$(document).on('click', "#btnSalvar", function () {
var erros = 0;
$("div").find('*').each(function () {
var classe = $(this).attr("class");
if (classe !== undefined) {
if ($("" + classe + ":contains(has-error)")) {
}
}
});
});
What I’ve done so far.
Edit:
How to brand solved for two people at once? hhaha Thanks to all
I don’t know if I understood it very well, but it wouldn’t be simpler to use the Class Selector? It would look something like this:
$('div.has-error')...
You could also remove the div and leave only the class.– Randrade
I believe so, but I do not know how to implement, as would be in my code?
– gabrielfalieri
var numItems = $('.item'). length;
– user60252
thanks man, thank you
– gabrielfalieri