Form submission handler with terms and conditions checkbox and double-click prevention I'm experienced with JavaScript, but new to refactoring.  Sonar specified that the below function is too complex.  I'm looking for suggestions on how to simplify it, mainly the conditional statements.

_executeWhenReady: function() {
    if ($('#applyButton').length) {
        $('#applyButton').on('click', function(e) {
            if (appProcessing.isTermsChecked() &amp;&amp; !$('#applyButton').hasClass('noClick')) {
                $('#applyButton').addClass('noClick');
                appProcessing.proceedToApp();
            } else {
                e.preventDefault();
                $("#termsConditionsChBx").removeClass('checkbox-checked').removeClass('checkbox').removeClass('checkbox-error').addClass('checkbox-error');
                if ($('.checkboxErrorText').length) {
                    $('.checkboxErrorText:first').removeClass('hidden');
                }
                return false;
            }
        });
    }

    if ($('#btnBenefitsCancel').length) {
        $('#btnBenefitsCancel').on('click', function() {
            $('#benefitsCancel').attr('value', true);
        });
    }

    if ($("#termsConditionsChBx").length) {
        $('#termsConditionsChBx').on('click', function() {
            appProcessing._eConsentCheck("termsConditionsChBx");
        });
    }
    $("#termsConditionsChBx_Native").on('change', function() {
            appProcessing._eConsentCheck("termsConditionsChBx");
    });
}
A couple thoughts:


Don't keep re-querying the DOM with jQuery selectors. This is poor from a performance standpoint.  Put the jQuery collection into a variable and don't keep re-querying the DOM every time you need to work with the collection.


For example:

var $applyButton = $('#applyButton');
var $btnBenefitsCancel = $('#btnBenefitsCancel');


Or for case when you need to find one element in collection like your :first selector:

var $checkboxErrorText = $(.checkboxErrorText);
if($checkboxErrorText.length) {
    $checkboxErrorText.first().removeClass('hidden');
}


A good rule of thumb is if you find yourself using the selector (or some subselection of it) more than once, put it into a variable.


Why do you need to check if there are any elements that meet the condition for adding the click handlers?  You could easily remove the $(*).length checks and your code would function exactly the same (and probably make Sonar very happy at the same time). Same thing applies to the checkboxErrorText example. It is OK to try to operate against a zero length jQuery collection in most cases. I would reserve such tests of collection size to those cases where you need to have alternate code behavior if the selector returns an empty collection. This is not really the case for the use cases you have shown (though it could be if you needed to do something like log an error or alert the end user of an empty selection result).
Be more consistent in how you name your DOM element id's. It is confusing to have one button name like applyButton and another like btnBenefitsCancel. You can read up on semantic naming for your HTML id's, class names, etc. to formulate a good approach on having a consistent naming strategy.
You have some really long line of code, which make your code hard to read.  


For example, take this line of code:

            $("#termsConditionsChBx").removeClass('checkbox-checked').removeClass('checkbox').removeClass('checkbox-error').addClass('checkbox-error');


You could make this more readable in several ways.  First just breaking up across lines:

            $("#termsConditionsChBx")
                .removeClass('checkbox-checked')
                .removeClass('checkbox')
                .removeClass('checkbox-error')
                .addClass('checkbox-error');


But you can also pass multiple class name into removeClass() and addClass(), so you could actually implement like this if you like:

            $("#termsConditionsChBx")
                .removeClass('checkbox checkbox-checked checkbox-error')
                .addClass('checkbox-error');


This approach would actually perform better as well, as the collection would only be iterated a single time to remove all those classes as opposed to iterating three times due to having having three different removeClass() calls. If you are working with large collections, this could add up.

The same approach of splitting longer lines of code across multiple lines could also be applied to longer conditionals like this line of code:

        if (appProcessing.isTermsChecked() &amp;&amp; !$('#applyButton').hasClass('noClick')) {


Could be:

        if (
            appProcessing.isTermsChecked() &amp;&amp;  
            !$('#applyButton').hasClass('noClick')
        ) {


If you should consider incorporating style checks into your static code analysis such that you can automatically flag style issues like lines of code that are too long (typically ~80 characters).