I want to add <em>
tag after textbox, if user inserted non-numeric format.
$('.numeric').keypress(function (e) {
var key_code = e.which;
if (key_code != 8 && key_code != 0 && (key_code < 48 || key_code > 57)) {
$(this).after("<em>type only numeric formatted text<em>");
return false ;
}
else {
$('em').remove();
}
});
Textboxes more than one. HTML code:
<div>
<label for="Area">Full Area:</label>
<input type="text" value="" name="FullArea" id="FullArea" class="numeric">
</div>
In my jQuery code have some issues:
Will add
<em>
more than one time, after non-numeric format;Will remove all
<em>
tag, if user typed numeric format (near other textboxes too, allem
in page)
Need smart way to do this functionality, without issues [1] and [2]. Thanks.