Return to Snippet

Revision: 50693
at August 30, 2011 17:46 by nareshrevoori


Updated Code
(function ($) {

    var sTime = new Date().getTime();
    $(function () {

        return $('form').each(function (i, frm) {
            var inputs = $(frm + ':input');
            $.each(inputs, function () {
                if ($(this).attr('type') == 'text') $(this).attr('name', $(this).attr('name') + "_" + sTime);
            });

            $(frm).bind('submit', function () {
                var inputs = $(frm + ':input');
                $.each(inputs, function () {
                    if ($(this).attr('type') == 'text') $(this).attr('name', $(this).attr('name').replace('_' + sTime, ''));
                });
            });
        });
    });

})(jQuery);

Revision: 50692
at August 30, 2011 17:44 by nareshrevoori


Updated Code
(function($){
	var sTime = new Date().getTime();
	
	$(function(){
		
		return $('form').each(function(i, frm){
			var inputs = $(frm +':input');
			$.each(inputs, function(){
				if($(this).attr('type') == 'text')
					$(this).attr('name', $(this).attr('name') + "_" + sTime);
			});

			$(frm).bind('submit', function(){
				var inputs = $(frm +':input');
				$.each(inputs, function(){
					if($(this).attr('type') == 'text')
						$(this).attr('name', $(this).attr('name').replace('_'+sTime, ''));
				});	
			});
		});
	});

})(jQuery);

Revision: 50691
at August 30, 2011 17:42 by nareshrevoori


Initial Code
var sTime = new Date().getTime();
	
	$(function(){
		
		return $('form').each(function(i, frm){
			var inputs = $(frm +':input');
			$.each(inputs, function(){
				if($(this).attr('type') == 'text')
					$(this).attr('name', $(this).attr('name') + "_" + sTime);
			});

			$(frm).bind('submit', function(){
				var inputs = $(frm +':input');
				$.each(inputs, function(){
					if($(this).attr('type') == 'text')
						$(this).attr('name', $(this).attr('name').replace('_'+sTime, ''));
				});	
			});
		});
	});

})(jQuery);

Initial URL

                                

Initial Description

                                

Initial Title
Jquery Prevent autofill form fields by browsers

Initial Tags
form

Initial Language
jQuery