I have two select lists and need to change the value of one based on their current state so:
Select list 1:
Option A (All)
Option B (12)
Option C (13)
Select list 2:
Option 1 (All)
Option 2 (14)
Option 3 (15)
Option 4 (16)
If select list 1 = Option C && select list 2 = Option 2 then change select list 1 to Option A.
I have the following code:
$('#edit-lines, #edit-trading-options').change(function () {
if ($('#edit-lines').val().indexOf(13) && $('#edit-trading-options').val().indexOf(14) > -1) $('#edit-trading-options').val('All');
});
But something's not right. The second select stays at 'All' all the time.
Thanks,
Steve
.indexOf, you need to use!= -1, like you did for the second test.