title: How do I change a hardcoded path to a dynamic one in javascript?
body: <p>I'm using the jpicker color picker widget with my theme. Inside the js file I've had to hardcode the reference to the jpicker's images folder like so...</p>
  
  <pre><code>images:{clientPath: '../wp-content/themes/MyThemeFolder/js/jPicker/images/',
  </code></pre>
  
  <p>I would like to redo this to by more dynamic in case the user changes the name of the theme folder.</p>
  
  <p>Any ideas? URL parsing?</p>
  
  <p>UPDATE: Here's what I had to do to resolve it...</p>
  
  <p>Inside of functions.php and just before the js script is included, I placed this...</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  &lt;?php echo 'var myThemePath="../wp-content/themes/'.get_option("template").'/js/jPicker/images/"';?&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>Then, inside the .js file, I did a replace on the hardcoded directory path so that this...</p>
  
  <pre><code>images:{clientPath: '../wp-content/themes/MyThemeFolder/js/jPicker/images/',
  </code></pre>
  
  <p>Becomes this...</p>
  
  <pre><code>images:{clientPath: myThemePath,
  </code></pre>