title: jQuery : map option values
body: <p>I have a select list like this -</p>
  
  <pre><code>&lt;select&gt;
      &lt;option value='A,textA$$B,textB' data-id='1'&gt;some text&lt;/option&gt;
      &lt;option value='C,textC$$D,textD' data-id='2'&gt;some text&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I am trying to get this string as output -</p>
  
  <pre><code>1-1-A-textA,2-1-B-textB,3-2-C-textC,4-2-D-textD
  </code></pre>
  
  <ul>
  <li>1        - is just an index like 1,2,3,4..</li>
  <li>1       - data-id</li>
  <li>A       - text before <code>,</code></li>
  <li>textA   - text after <code>,</code></li>
  </ul>
  
  <p>Iv'e tried this (though, i know this is incomplete as i can't go beyond this)</p>
  
  <pre><code>var s = $('select option').map(function(){
     return this.value.split('$$').join(',');
  }).get();
  </code></pre>
  
  <p>Fiddle -- <a href="http://jsfiddle.net/NgQzH/2/" rel="nofollow">http://jsfiddle.net/NgQzH/2/</a></p>