Restrict Exponents and periods(.) in numeric textbox html
<p>I have a numeric textbox, by default numeric textbox allows Exponents and periods.
How do i restrict that?</p>

<p>One of the method i can think of is using string.replace on input event however it is not working as expected. Below is my code..</p>

<p>HTML</p>

<pre><code>     &lt;input type='number' class='number'&gt;
</code></pre>

<p>JavaScript</p>

<pre><code>     $(".number").on('input', function () {
            this.value = this.value.replace(/e|E|\./g, ''); // Remove e, E, and period(.)
            if (this.value.length &gt; 4) {
                this.value = this.value.slice(0, 4);
            }
        });
</code></pre>

<p>When i enter string '2e' in textbox, entire input is getting removed if above code is ran. i just wants to remove e, E or period from input string not entire input. </p>

<p>Is there a way to achieve this.</p>

<p><a href="https://jsfiddle.net/8vanqrev/1/" rel="nofollow">JSfiddle</a></p>

<p>Answer BY <em>nichel</em> is working like a charm, now my problem is how do i restrict the same in PASTE event.?</p>