I have a number of instances like this in a particular process where I am appending a name to a list. I set them up several years ago. But now I find that they are no longer working and I don't know why:
$(document).ready(function() { $('.approverDecision').on('click', function(){ var DeptHeads = []; if ($('.deptCode input').val()=='0604000 City Attorney') { $.each($('.DeptHeadList option'), function(){ DeptHeads.push($(this).val()); }); if ($.inArray('JOHN DOE', DeptHeads) == -1){ $('.DeptHeadList select').append('<option>JOHN DOE</option>'); } } }); });
But in a different process I'm doing the same thing and it IS working:
$(document).ready(function() { $('.sendToAltApvr input').on('click', function(){ var allApvrs = []; if ($('.submitterEID input').val()=='12731'){ $.each($('.AltApvList option'), function(){ allApvrs.push($(this).val()); }); if ($.inArray('JANE DOE', allApvrs) == -1){ $('.AltApvList select').append('<option>JANE DOE</option>'); } } }); });
The one different between the two is in the "on click" function - the first example uses a radio button and the second example uses a checkbox. At first I thought it was just a matter of adding "input" after ".approverDecision" but that didn't work either. I appreciate any advice. This is version 11. Thank you.