title: rounding decimal numbers of results in jquery
body: <p>I've got this code - </p>
  
  <pre><code>$(document).ready(function() {
    $(function(){
  $("#result").submit(function(e) {
     e.preventDefault();
     var ele = $("#element").val(),
      target = $("#target").val(),
      context = $("#context").val(),
      border = $("#border").val(),
      margin = $("#margin").val(),
      padding = $("#padding").val();
  
  console.log(ele, target, context, border, margin, padding);
  
  var DoubleMargin = parseInt(margin, 10) * 2;
  var DoublePadding = parseInt(padding, 10) * 2;
  var DoubleBorder = parseInt(border, 10) * 2;
  
  
  var ActualTarget = parseInt(target, 10) - parseInt(DoubleBorder, 10) - parseInt(DoubleMargin, 10) - parseInt(DoublePadding, 10) * 1;
  var result3 = parseInt(target, 10) - parseInt(DoubleMargin, 10) * 1;
  var MarginResult = parseInt(margin, 10) / parseInt(target, 10) * 100;
  var PaddingResult = parseInt(padding, 10) / parseInt(target, 10) * 100;
  var OriginalResult = parseInt(ActualTarget, 10) / parseInt(context, 10) * 100;
  var BorderResult = parseInt(target, 10) - parseInt(border, 10) * 1;
  
  //$(".result").append(ele + " " + result + "%");
  $("&lt;p&gt;&lt;/p&gt;", {
      html: ele + " {&lt;br&gt;&lt;span&gt;width: " + OriginalResult + "%;" + " /* " + ActualTarget + " (originally " + target + ") / " + context + " */ " + "&lt;br&gt;border: " + border + "px; " + "&lt;br&gt;margin: " + MarginResult + "%; " + "&lt;br&gt;padding: " + PaddingResult+ "%;" + "&lt;br&gt; &lt;/span&gt;}"
  }).hide().appendTo("#code-results").fadeIn();
     });
  
  }); 
  
  });
  </code></pre>
  
  <p>and I want the results to round the decimal point to just 5 places. I think I should be using </p>
  
  <pre><code>var num.toFixed(5)
  </code></pre>
  
  <p>but I can't get it to work</p>
  
  <p>any ideas?</p>
  
  <p>edit: thanks for comments - basically the results for OriginalResult, MarginResult and Padding Result could have a result of  1.0204081632653061%; which I want to only have the first 5/6 fractional points so it's 1.020408% for example. Is there a 'catch all' than can be applied?</p>
  
  <p>I've put it up on jsfiddle - <a href="http://jsfiddle.net/sturobson/xTEKm/37/" rel="nofollow">http://jsfiddle.net/sturobson/xTEKm/37/</a> :)</p>