How to add space between numbers in phone fields? Just simply copy the codes below and paste it into your .js file or on head sections.
jQuery(document).ready(function($) { $( '#phone' ).keypress(function(){ $( this ).attr( 'maxlength', '13' ); var str = $(this).val(); var n = str.length; if( n == 3 || n == 8 ){ str = str + ' '; $( this ).val( str ) } }); });