I am having problem with the following line:
document.getElementById("giftcard").getElementsByTagName("label").style.backgroundImage ="url(giftcard_icon-d.jpg)";
I am trying to change background image after clicking a label.
I do have 5 labels in a page, but when i click on label, the background should change it. Other labels should be reset to use this giftcard_icon-d.jpg image as their background.
How can I fix this?
$(document).ready(function() {
$('#giftcard label').click(function() {
document.getElementById("giftcard").getElementsByTagName("label").style.backgroundImage ="url(giftcard_icon-d.jpg)";
this.style.backgroundImage ="url(giftcard_icon-a.jpg)";
});