AnsweredAssumed Answered

Checkboxes can no loger be checked/selected programmatically after clearing them

Question asked by cbanquer on May 17, 2017
Latest reply on May 22, 2017 by cbanquer

Hello!

 

I am creating an order form and have custom JavaScript functions that check checkboxes based on the bundle selected.

Checking those boxes work without problems.

When the bundle is changed, I want to clear all boxes first, then check the appropriate boxes for the new bundle selected.

 

My problem: When the checkboxes are cleared, either by the “clearAllCheckboxes()” function or manually, the checkboxes can no longer be checked programmatically. What am I missing?

 

Here is my code:

//COMPUTER BUNDLE =====

 

function populateSalesBundle(){

NWF$('#'+varLaptop).find('input[value=\'Laptop\']').attr('checked', 'checked');

NWF$('#'+varLTCase).find('input[value=\'Case\']').attr('checked', 'checked');

NWF$('#'+varCableLock).find('input[value=\'Cable Lock\']').attr('checked', 'checked');

};

 

function populateExecutiveBundle(){

NWF$('#'+varDesktop).find('input[value=\'Desktop\']').attr('checked', 'checked');

NWF$('#'+varLaptop).find('input[value=\'Laptop\']').attr('checked', 'checked');

};

 

function populateWorkFromHomeBundle(){

NWF$('#'+varLaptop).find('input[value=\'Laptop\']').attr('checked', 'checked');

NWF$('#'+varKeyboard).find('input[value=\'Keyboard\']').attr('checked', 'checked');

NWF$('#'+varDockingStation).find('input[value=\'Docking Station\']').attr('checked', 'checked');

NWF$('#'+varLTCase).find('input[value=\'Case\']').attr('checked', 'checked');

NWF$('#'+varCableLock).find('input[value=\'Cable Lock\']').attr('checked', 'checked');

NWF$('#'+varDTMonitor).find('input[value=\'Monitor\']').attr('checked', 'checked');

NWF$('#' + varDTMonitorQty).val(2);

};

 

function clearAllCheckboxes(){

NWF$('input[type=checkbox]').prop('checked', false);

};

 

//END COMPUTER BUNDLE SECTION=====

Outcomes