我遇到的问题是预订表单上有几个数字输入字段。它们有向上和向下箭头,这很好,但当在Chrome中使用向上箭头时,它不是按1向上,而是很容易一次按几个数字向上(无需按住鼠标)。
其他人经历过这种情况吗?除了将其隐藏在Chrome中之外,还有其他修复方法吗?
感谢
此外,以下是带有事件处理程序的完整代码:
$(".product_holder input").bind('keyup change click', function (e) {
if ($('#startDate').val() != "" && $('#endDate').val() != "") {
if (!$(this).data("previousValue") || $(this).data("previousValue") != $(this).val() ) {
if ($(this).is("[max]") && ( $(this).val() >= $(this).attr('max') ) )
{
if (! $(this).parent().find(".validwarnning").length > 0)
{
$(this).parent().append("<div class='validwarnning'>The maximum number has been reached</div>");
}
$(this).val($(this).attr('max'));
}
else
{
$(this).data("previousValue", $(this).val());
//$(this).parent
$thisProduct = $(this).parent();
WriteItemRow($thisProduct);
updateTableTotal();
}
}
}
else
{
$('#startDate').addClass("error_input");
$('#endDate').addClass("error_input");
$('#dateError').html("Please select your dates first");
$(this).val("0");
}
});
您应该在输入标记step='1'
上包含一个step属性