Form input field value replace onchange with jQuery

If someone put text into an input field (or automatic e.g. with a 2d barcode scanner) and you want to replace a part of the input (pattern) then will help this small jquery code snippet.
[javascript]
<input name="field" id="field" type="text" value="" class="delprefix">

<script type="text/javascript">
$(document).ready(function() {
$(‘.delprefix’).change(function() {
var value = $(this).val();
//alert(value);
$(this).val(value.replace(/00040E-/i, ”));
});
});
</script>
[/javascript]

Leave a Reply