Get left, right values with out px in jquery
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/490508/left-function-in-javascript-or-jquery">Left() function in Javascript or jQuery</a>  </p>
</blockquote>



<p>I have one div and i give style like below.</p>

<pre><code>#MainDiv
{
    position:relative;    
    left:150px;
    right:150px;

}
</code></pre>

<p>I want to give the width of this <code>#MainDiv</code> based on the left and right parameters. For this I give like below.</p>

<pre><code>$("#MainDiv").width($("#MainDiv").width() - $("#MainDiv").css("left") - $("#MainDiv").css("right"));
</code></pre>

<p>But  <code>$("#MainDiv").css("left")</code> is giving me <code>150px</code> in the alert. I want only the <code>150</code>. For that I used <code>offset</code> property, <code>$("#MainDiv").offset().left</code> and <code>$("#MainDiv").offset().right</code>. The left value is coming as <code>158</code> and right is coming as <code>undefined</code>. <code>offset</code> is not correct at this situation? How should I remove that <code>px</code> at the end of the value and get the exact value?</p>
