textbox value with hard coded dash
<p>I have a textbox in the page. <code>&lt;input type="text" id="cell"&gt;</code></p>

<p>I have used below jquery....</p>

<pre><code>i = 0;
$(document).ready(function () {
    $("#cell").keypress(function () {
        i += 1;
        if (i == 4) {
            var cellValue = $("#cell").val() + "-";
            $("#cell").val(cellValue);
        }
    });
});
</code></pre>

<p>whenever an user types <code>12345678</code> (or any number) it automatically shows <code>123-45678</code>. But problem is when user uses backspace or delete and then starts typing <code>12345678</code> it does not show <code>123-45678</code>. Please help</p>
