当您在出生日期输入一个数字月份时,我需要帮助,该月份将自动在输入中的单个数字中添加0位数。这是我的代码:
public static void findSum (int[] arr) {
int i = 0;
while (i < arr.length-1) {
//define resu and j on the inside as these change with every i
//start j from the i+1
int j = i+1;
//define resu as the ith element
int resu = arr[i];
//keep adding to resu until we have reached end of array or until resu is greater than the target
while (j < arr.length-1 && resu < 14){
//add the jth element of the array
resu = resu + arr[j];
//print if we have a match
if (resu == 13){
System.out.println("interval " + i + " and " + j + " is 13");
}
j++;
}
i++;
}
}
答案 0 :(得分:0)
您已指定要检查$('#dob_dd')
的长度。也许它应该是:
if (addzero != 2)
当然,您需要使用例如$('#dob_dd').val("new value")
答案 1 :(得分:0)
如果要更新显示的值。它就像
一样简单$('#dob_dd').blur(function(){
var $this = $(this);
$this.value(('0' + $this.value()).substr(-2));
});
如果选择器也选择了多个目标,这将正常运行