Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I'm trying to validate input fields when the value is empty. I want to only target input fields using a certain class. I have tried to use .hasClass("required") without any success.
I hope somebody can help.
EDIT = Should of pasted the rest.
$('.className')...
if $(this).hasClass("required")...
from:
$('input').each(function() {
to:
$('input.yourclassname').each(function() {
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
$('.className')...if $(this).hasClass("required")...What's the problem? I'm having difficulties to understand where is your problem.