Change background image dynamically on checked checkbox

FloristikaPiter

New Member
Hi this is my first question in the stackoverflow community and I am having problems changing the background image of my webpage dynamically when a checkbox is checkedHTML:\[code\]<ul> <li><label for="Lines">Add Fun: </label><input type="checkbox" id="Lines" name="Lines" /></li></ul>\[/code\]jQuery:\[code\]<script type="text/javascript"> if ($('#Lines').is(':checked')) { $("body").css({'background-image': 'url(http://upload.wikimedia.org/wikipedia/commons/d/d3/Mud_wrestling_couple.jpg)'}); }</script>\[/code\]I want it to change the background of the body as soon as the checkbox is checked. The image is just a random one I found online. Think I might be overlooking something. Thanks for the help!
 
Back
Top