How to make validation disabled selects s table?

https://jsfiddle.net/KLON/xzqv6rc8/1/

there is a sign there will be in every td single select statement , each select have option value = "none" rows will be unknown how many lines a lot too.

it is necessary when choosing != none to do the following select is not disabled and Vice versa , as if a ladder to enable or disable all selects , when you turn off need to clean up value

The frame of the table, we can put any class id and everything your heart desires )

as such a cunning system to stir up?
March 19th 20 at 08:58
1 answer
March 19th 20 at 09:00
Solution
$('table').on('change', function(e) {
const
 $target = $(e.target),
 $next = $target.closest('td').next().find('select'),
 isNone = $target.val() === 'none';

 $next.prop('disabled', isNone);
 if (isNone) {
$next.val('none');
}
});
well magic right o_o
only thought at the moment of checking, if you turn off one select from the middle then the next is still enabled
NAuRlGp.png
is it even possible to do? - marcelina.Mante commented on March 19th 20 at 09:03
@marcelina.Mante, then this:

$('table').on('change', function(e) {
const
 $target = $(e.target),
 isNone = $target.val() === 'none',
 $next = $target.closest('td')[isNone ? 'nextAll' : 'next']().find('select');

 $next.prop('disabled', isNone);
 if (isNone) {
$next.val('none');
}
});
- Maryjane_Schneider commented on March 19th 20 at 09:06
@Maryjane_Schneiderhow much you need to work to fumble as you...?
and you do not have a blog or tweeter or channel on YouTube? I'd love to hear your "thorny history" ) - marcelina.Mante commented on March 19th 20 at 09:09

Find more questions by tags jQuery