Posted By

nareshrevoori on 08/30/11


Tagged

form fields autofill prevents


Versions (?)

Jquery Prevent autofill form fields by browsers


 / Published in: jQuery
 

  1. (function ($) {
  2.  
  3. var sTime = new Date().getTime();
  4. $(function () {
  5.  
  6. return $('form').each(function (i, frm) {
  7. var inputs = $(frm + ':input');
  8. $.each(inputs, function () {
  9. if ($(this).attr('type') == 'text') $(this).attr('name', $(this).attr('name') + "_" + sTime);
  10. });
  11.  
  12. $(frm).bind('submit', function () {
  13. var inputs = $(frm + ':input');
  14. $.each(inputs, function () {
  15. if ($(this).attr('type') == 'text') $(this).attr('name', $(this).attr('name').replace('_' + sTime, ''));
  16. });
  17. });
  18. });
  19. });
  20.  
  21. })(jQuery);

Report this snippet  

You need to login to post a comment.