Javascript-форум (https://javascript.ru/forum/)
-   Элементы интерфейса (https://javascript.ru/forum/dom-window/)
-   -   Ограничение по введенному числу input (https://javascript.ru/forum/dom-window/55434-ogranichenie-po-vvedennomu-chislu-input.html)

petlyra5 27.04.2015 19:02

Ограничение по введенному числу input
 
Всем привет. А подскажите как поставить минимальное значение для поля input
$("#modalProducts").find(".first .btn").on("click", function () {
		$("#modalProducts").addClass("modal-contact");
		$(".first").css("display","none");
		$(".second").fadeIn(700);

		var productWeight = $(this).parents(".products__item").find(".products__weight").text();

		var quantity = $(this).parents(".products__item").find(".quantity").val();
		var prodArt = $(this).parents(".products__item").find("#prodArt").val();
		var price = $(this).parents(".products__item").find(".price").text();
		var summ = quantity * price;


		$(".second").find("input[name=OutSum]").val(summ);
		$(".second").find(".s-orderPrice .price").text(summ);
		$(".second").find(".s-orderTitle span").text(productWeight);

		$(".second").find("#quant").val(quantity);


		$(".second").find("#Desc").val("Икра черная осетровая " + productWeight);
		$(".second").find("#Shp_item").val(prodArt);


		var data = $("#orderIkra").formSerialize();
	});

	$('.products__item__ikra .products__item a').on("click", function () {
		$("#modalProducts").addClass("modal-contact");
		$(".first").css("display","none");
		$(".second").fadeIn(700);

		var productWeight = $(this).parents(".products__item").find(".products__weight").text();
		var quantity = $(this).parents(".products__item").find(".quantity").val();
		var prodArt = $(this).parents(".products__item").find("#prodArt").val();
		var price = $(this).parents(".products__item").find(".price").text();

		$(".second").find("input[name=OutSum]").val(price);
		$(".second").find(".s-orderPrice .price").text(price);
		$(".second").find(".s-orderTitle span").text(productWeight);

		$(".second").find("#quant").val(quantity);

		$(".second").find("#Desc").val("Икра черная осетровая " + productWeight);
		$(".second").find("#Shp_item").val(prodArt);

		var data = $("#orderIkra").formSerialize();
	});


	$('#modalProducts').on('hidden.bs.modal', function (e) {
		$(".first").css("display","block");
		$(".second").css("display","none");
		$(this).removeClass("modal-contact");
	});


	// аккордион
	$('#accordion').on('show.bs.collapse', function (e) {
		$(".panel").removeClass("active");
		$(e.target).parents('.panel').addClass('active');
	});

	$('#accordion').on('hide.bs.collapse', function (e) {
		$(e.target).parents('.panel').removeClass('active');
	});


	// валидация формы

	$("#orderIkra").validate({
		rules: {
			inputFio: {
				required: true
			},
			inputPhone: {
				required: true
			},
			inputAddress: {
				required: true
			}
		},
		messages: {
			inputFio: {
				required: "заполните это поле"
			},
			inputPhone: {
				required: "заполните это поле"
			},
			inputAddress: {
				required: "заполните это поле"
			}
		},
		errorClass: "error",
		submitHandler: function(form) {
			$('#orderIkra').find('.orderIkra1__spinner').fadeIn('400');
			$(form).ajaxSubmit({
				success: function() {
					setTimeout(function () {
						$('.orderIkra__spinner').fadeOut('400');
						$('.modal__form1').fadeOut('400');
						setTimeout(function () {
							$('.modal__success1').fadeIn('600');
						}, 500);
						yaCounter26868429.reachGoal('order');
						yaCounter25630763.reachGoal('order');
						$("#orderIkra").clearForm();
					}, 1500);
				}
			});
		}
	});

Andrew_Nest 27.04.2015 23:39

А не проще просто проверку на кол-во символов сделать?


Часовой пояс GMT +3, время: 14:12.