title: JavaScript/JQuery string replace
body: <p>I have the following string which is a CSS selector:</p>
  
  <pre><code>#downloads &gt; ul &gt; li:nth-of-type(1) &gt; ul &gt; li:nth-of-type(3) &gt; a
  </code></pre>
  
  <p>This CSS selector works fine in FireFox, CHrome and Safari but IE 6 does not support the nth-of-type selector.  The CSS selectors I am working with are generated by Nokogiri and I can not change them.</p>
  
  <p>Threw testing I have got the following working:</p>
  
  <pre><code>#downloads &gt; ul &gt; li:nth(0) &gt; ul &gt; li:nth(2) &gt; a
  </code></pre>
  
  <p>Changing the nth selector to a plain nth and subtracting one from the nth value.  I have been trying to programmitcally with JS to convert a CSS selector from using nth-of-type to normal nth?  So after running it threw:</p>
  
  <pre><code>#downloads &gt; ul &gt; li:nth-of-type(1) &gt; ul &gt; li:nth-of-type(3) &gt; a
  </code></pre>
  
  <p>Would become</p>
  
  <pre><code>#downloads &gt; ul &gt; li:nth(0) &gt; ul &gt; li:nth(2) &gt; a
  </code></pre>
  
  <p>Cheers</p>
  
  <p>Eef</p>