Это текущие фрагменты кода. Я пробовал несколько разных способов, и ничего не работает. Пожалуйста, помогите !!!
HTML Фрагмент
<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" checked>
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
JQuery Фрагмент
var backgroundImg = ['../images/heroBG.jpg', '../images/heroBG2.jpg'
];
var backgroundCount = 0;
$(function () {
$('hero').css('background', 'url(' + backgroundImg[backgroundCount] + ')');
});
$('myonoffswitch').on('click', function () {
backgroundCount++;
if (backgroundCount > backgroundImg.length - 1) backgroundCount = 0;
$('hero').css('background', 'url(' + backgroundImg[backgroundCount] + ')');
});