Quiero cambiar la imagen de fondo de html con la selección del botón de opción. Cada botón de radio tiene una imagen diferente. Lo probé como:Cambiar la imagen de fondo con el botón de opción
<input name="BG" id="wood" type="radio" value="" class="bgCollection" />
<label for="radio">Wood</label>
<input name="BG" id="steel" type="radio" class="bgCollection"/>
<label for="radio">Steel</label>
<input name="BG" id="metal" type="radio" value="" class="bgCollection"/>
<label for="radio">Black metal</label>
Jquery:
$(document).ready(function(){
$(".bgCollection").change(
function()
{
if($("input#wood").attr("checked"))
{$("html").css('backgroundImage','url(../images/wood.jpg)');}
if($("input#steel").attr("checked")
{$("html").css('backgroundImage','url(../images/BG-steel.jpg)');}
if($("input#metal").attr("checked"))
{$("html").css('backgroundImage','url(images/blackMetal.jpg)');}
});
});
Pero de esta manera el fondo no está cambiando.
Sería bueno si publica el código ejecutable con jsfiddle. – uuidcode