What I would like to do is get the id of an element that has a different border, in this case its border is red, so I can process it in another method.
Current code:
if ($('#txtNombreP').hasClass('borcolo')) {
alert('El elemento tiene borde rojo');
} else {
alert('El elemento tiene borde blanco');
}
The above code identifies me which border my element has, now that I know which border it has, I would like to get the id of said element. I have 20 elements inside this window and more in other forms to which this method is going to be applied, so I don't think it can be done inside the if, it would be a lot of code.
Here I leave you this example that shows how you can go through the elements that have a specific class and also for those that do not.
According to what you say:
And this next...
I am sure that this code can help you, you simply go through all the child elements of your parent element and do the if validation, returning the id of said element in each case