Javascript sorting numbers in an HTML table with different number of digits
<p>[EDIT: These are all great methods for changing the way I sort. However I can't change the sorting method, unless one of you knows how to do that. In my JS there is a very long sorting algorithm that I didn't write. I'm not really sure how I would edit it to incorporate any of these sorting methods. Hence why I asked for a way to make them sort alphabetically by just changing the strings themselves.]</p>

<p>I have a table that has a sort button and everything works except for 1 column.</p>

<p>How do I sort 6", 12", and 18"? </p>

<p>They sort in the order 6" 18" 12" because of the quotes. I dont really want to remove the quotes and specify in the header that it is measured in inches... and I dont want to put a 0 before the 6 (which would also work). Ideally I want to put a space before the 6, but that space gets ignored for sorting. Anyone have any thoughts?</p>

<p>My inputs are just defined in a simple array:</p>

<pre><code>var paras1 = [
  ["K"],
  ["-270°C to 1372°C, –454°F to 2501°F"],
  ['0.125 (1/8")', '0.1875 (3/16")', '0.250 (1/4")'],
  ['6"', '12"', '18"'], //-------THE LINE THAT I CARE ABOUT-------
  ["316SS"],
  ["Grounded", "Ungrounded", "Exposed"],
];
</code></pre>

<p>Ive tried the following:</p>

<pre><code> [' 6"', '12"', '18"'] //with space doesnt work
 ['06"', '12"', '18"'] //with 0 works and looks ugly
 ['6', '12', '18']     //works but not what i want
</code></pre>

<p>If you have some creative characters that would help sort, you can try them out on line 486 if that helps, <a href="https://jsfiddle.net/msirkin/duw5nyqe/9/" rel="nofollow">https://jsfiddle.net/msirkin/duw5nyqe/9/</a></p>