Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery telephone input mask

	// jQuery-плагин для установки курсора в определенной позиции pos:
	$.fn.setCursorPosition = function (pos) {
		if ($(this).get(0).setSelectionRange) {
			$(this).get(0).setSelectionRange(pos, pos);
		} else if ($(this).get(0).createTextRange) {
			var range = $(this).get(0).createTextRange();
			range.collapse(true);
			range.moveEnd('character', pos);
			range.moveStart('character', pos);
			range.select();
		}
	};

	$('[name="phone"]').click(function () {
		$(this).setCursorPosition(3);
	}).mask('+7 (999) 999-99-99');
 
PREVIOUS NEXT
Tagged: #jquery #telephone #input #mask
ADD COMMENT
Topic
Name
1+8 =