I have this code to capture all form inputs and it’s working, however, I’m trying to exclude those in a certain div that is a dropdown that is common to the jsp’s. I assigned the div to a class for this as a possible solution.
Here is the original working line of code:
$(':input', document.formName).change(function() { ...
then I use an if statement:
if($('.className:not(.selected)')){
do something ...
but the if statement isn’t right somehow. What is the best way to do this? Is there a way to combine everything in one statement or is the if block the right way and if so, what is the correct syntax to exclude a class?
You can use
.notin your selector to exclude elements with the class.selectedor even
Here’s a fiddle.