Posted By

bassdas on 08/14/12


form input replace jquery field onchange

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


Form input field value replace onchange with jQuery

 / Published in: 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.

  1. <input name="field" id="field" type="text" value="" class="delprefix">
  3. <script type="text/javascript">
  4. $(document).ready(function() {
  5. $('.delprefix').change(function() {
  6. var value = $(this).val();
  7. //alert(value);
  8. $(this).val(value.replace(/00040E-/i, ''));
  9. });
  10. });
  11. </script>

Report this snippet  


RSS Icon Subscribe to comments
Posted By: Jacky888 on October 14, 2018

the 8 best tv antenna amazon

You need to login to post a comment.