0
我有一個表單,當狀態選擇列表發生更改時,狀態生效日期需要是必填字段。jquery:當選擇列表值發生更改時,需要輸入日期字段
function checkStatuses(){
$('.status').each(function(){
thisStatus = $(this).val().toLowerCase();
thisOrig_status = $(this).next('.orig_status').val().toLowerCase();
target = $(this).parents('td').nextAll('td:first').find('.datepicker');
if (thisStatus == thisOrig_status )
{
target.val('');
}
else if(thisStatus == 'production' || thisStatus == 'production w/o appl')
{
target.val('<cfoutput>#dateformat(now(), "mm/dd/yyyy")#</cfoutput>').focus();
alert('The Status Effective Date is required.');
return false;
}
else
{
target.val('<cfoutput>#dateformat(now(), "mm/dd/yyyy")#</cfoutput>');
return false;
}
});
}
返回false並不妨礙我的表單提交反正。上述表單正在被另一個函數調用像這樣:
return checkStatuses();
哦,男人,我太親近了! :) 感謝您的幫助。 – HPWD 2011-05-11 13:12:14
@ dlackey哈哈它發生了!祝你好運 – Chad 2011-05-11 13:13:59