I have the following code which works fine:
$(function mvp() {
var theMvp = ['#mvpWtd', '#mvpStd'];
$.each(theMvp, function (index, value) {
$(value + ' .budTySales').hide();
$(value + ' .lySales').hide();
$(value + ' .budReceipts').hide();
$(value + ' .lyReceipts').hide();
});
})
According to jquery documentation I should be able to pass multiple elements in followed by a comma instead of doing it line by line (less code too!). I tried changing my code to the below but it fails...
$(function mvp() {
var theMvp = ['#mvpWtd', '#mvpStd'];
$.each(theMvp, function (index, value) {
$(value + ' .budTySales',value + ' .lySales',value + ' .budReceipts',value + ' .lyReceipts').hide();
});
})
$(theMvp.toString()).find('.budTySales, .lySales, .budReceipts, .lyReceipts').hide();or better just use a specific common class...