Код: Выделить всё
У меня текущий код:
Код: Выделить всё
$("input[title=Target Date],input[title=Start Date],select[title=Strategic Objective],select[title=Strategic Priority]").change(function(){
checkControls()
});
,select[title=Strategic Priority],textarea.ms-input"), но это не работает, есть идеи?
Заранее спасибо.
Изменить: код проверки:
Код: Выделить всё
//bind a change event to all controls to validate
$("input[title=Target Date],input[title=Start Date],select[title=Strategic Objective],textarea[id$=_UserField_downlevelTextBox],select[title=Strategic
Priority]").change(function(){
checkControls()
});
//the change event function - check the status of each control
function checkControls(){
//set a variable to count the number of valid controls
var controlsPassed = 0;
//set up a selector to pick .each() of the target controls
$("input[title=Target Date],input[title=Start Date],select[title=Strategic Objective],textarea[id$=_UserField_downlevelTextBox],select[title=Strategic
Priority]").each(function(){
//if the control value is not zero AND is not zero-length
var val = $(this).val();
if($(this).is(':hidden') || (val != 0 && val.length != 0)) {
//add one to the counter
controlsPassed += 1;
}
});
//call the PreSaveItem function and pass the true/false statement of 5 valid controls
return (controlsPassed == 5);
}
function PreSaveItem() {
return checkControls()
}
edit3:
Я изменилась
Код: Выделить всё
return (controlsPassed == 5);
Код: Выделить всё
return (controlsPassed == 4) && ( ($("textarea[title='People Picker'][value!='']").length==1) || $("textarea[title='People Picker'][value!='']").is(":hidden") );
Код: Выделить всё
if ($("textarea[title='People Picker'][value!='']").is(":hidden")) {
return (controlsPassed == 4)
}
else {
return (controlsPassed == 4) && ( ($("textarea[title='People Picker'][value!='']").length==1);
>
Подробнее здесь: https://stackoverflow.com/questions/349 ... ith-jquery
Мобильная версия