problems creating a code output for a skinning tool

problems creating a code output for a skinning tool

I'm having problems with a jQuery prototype I'm working on. It's a skinning tool, and it allows you to choose colors and specify a URL for a background image. When you're done you can press a button and it generates HTML/CSS code and displays it in a text box:

  1. $('#getCode').bind('click', function() {

          //Script defining codeHead and codeEnd variables      



          var skinOutputUrl = $('#skinImgField').val();

          var skinOutput = '.ymp-skin{background-image:url(' + skinOutputUrl + ');} .ymp-color-main{ background-color:transparent;} .ymp-color-tray{background-color:transparent;}' ;

          $('#outputCode').val(codeHead + skinOutput + codeEnd);
     
    });
















The problem I'm having is that if someone chooses not to link a background image, I need the final code output to NOT include the skinOutput variable. How would I do this? I've tried an if/else statement but I'm not sure if I just don't know how to write them in jQuery, or if a completely different solution would be better.