Input mask with plain value
<p>What's the best way to create a input mask that keeps the original value (i.e. not masked one) in the input ?</p>

<p>For example:</p>

<p>let's use the mask <code>99999-999</code>, and the number <code>58398000</code>.</p>

<p>What I want is the number to be displayed as:</p>

<p><code>58398-000</code> and input's really value to be <code>58398000</code>.</p>

<p>I need this because the validation counts the number of digits and check if there's only digits.</p>

<p>And also the mask should appear when the page load with input's value setted.</p>

<p>Tried this one:
<a href="http://www.jasny.net/bootstrap/javascript/#inputmask" rel="nofollow">http://www.jasny.net/bootstrap/javascript/#inputmask</a></p>

<p>The jasny's plugin has 2 issues:</p>

<ul>
<li><p>First is that the input's value has the separator, for example <code>input.val() == "58398-000"</code></p></li>
<li><p>Second, when the page loads with value setted the mask isn't updated.
For example:
<code>&lt;input type="text" value="58398000" class="form-control" data-mask="99999-999"&gt;</code>, in this case the mask isn't displayed.</p></li>
</ul>

<p>P.S: Using bootstrap and jQuery</p>