background image not working

background image not working

hi there
i have this code below
if($('ul#nav li').hasClass('wp_home'))
                                                           {
                                            $('ul#nav li.wp_home').click(function() {
                                         $(this).addClass("current_page_item");
                                         
                                         
                                                                     });
                                                           }
i just want to find particular li with specific class and change the background by adding class when that li is click
i could not figure out whats going wrong with above code

any help appreciated
thank u