change Body Background on click jquery

cristianods

New Member
I have been working over a theme for MyBB, where i am trying to implement a jQuery Background switcher.I have been trying but not successful.Here is html :\[code\]<script src="http://stackoverflow.com/questions/14543836/images/vhut/style/pattern.js" type="text/javascript"></script><script type="text/javascript" src="http://stackoverflow.com/questions/14543836/{$mybb->settings['bburl']}/images/image directory/script/cookie.js"></script><a href="http://stackoverflow.com/questions/14543836/#" class="pat" id="pat1" style="background:url('images/image directory/style/patterns/pat1.jpg')">click 1</a><a href="http://stackoverflow.com/questions/14543836/#" class="pat" id="pat2" style="background:url('images/imag directory/style/patterns/pat2.jpg')">click 2</a>\[/code\]Here is the JS file i am using :\[code\]$(document).ready(function(){$('a.default').click(function(e){ var bg = $(this).css('background'); $('body').css('background','none')})$(".pat").click(function(){ $("body").removeClass('background'); if( $('#alpha-style').is(':checked')){ $('#alpha-style').attr("checked",false); $('.bg-alpha').hide(); }});$("#pat1").click(function(){$(body).css("background", "url(patterns/1.png)");return false;});$("#pat2").click(function(){$(body).css("background", "patterns/2.png)");return false;});});\[/code\]The patterns are located in a folder images/ theme directory/ style/patternsThe js file is located in images/theme directory/ styleSo can anyone help regarding my code or provide a possible solution for the error i am gettinghelp is appreciatedregards,
 
Back
Top