Posted By

bassdas on 08/14/12


Tagged

form input replace jquery field onchange


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

spee66
BrockSamsom


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">
  2.  
  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  

You need to login to post a comment.