-3

So I just upgraded my version of jquery to http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js and after that I believe I started getting these errors. Does anyone know if this jquery function is somewhat out of date with the new changes or why it would be throwing this now?

function CheckBrochuresSelected(checkBox) {
    var dataList = checkBox.parentNode.parentNode.parentNode.parentNode;
    var deliveryOption = $('.consumerbrochurerequest' > [id$ = '_rblDeliveryOption'])[0];
    var broxList = dataList.getElementsByTagName('input');
    var optionList = deliveryOption.getElementsByTagName('input');
**Uncaught TypeError: Cannot call method 'getElementsByTagName' of undefined
Uncaught TypeError: Cannot call method 'getElementsByTagName' of undefined**
    var broxLabels = dataList.getElementsByTagName('label');
    var travelPlannerIsChecked = false;
    var broxLabel = "";
    var eBrox = null;
4

1 回答 1

3
$('.consumerbrochurerequest' > [id$ = '_rblDeliveryOption'])

should be a string:

$(".consumerbrochurerequest > [id$='_rblDeliveryOption']")

As you have it now, it evaluates to a boolean value (false) and without error since that is a valid array, and therefore a valid expression. But $(false) evaluates to [] (an empty array) and you attempt to access the first element.

于 2013-06-25T14:50:28.183 回答