1
내가 진행 중 새로운 조건
- 와 드롭 다운 메뉴가 기반으로 선택된 요소를 숨길 필요가 순서가
- 는
- 는 을 취소 완료 순서가되지 않음
상태가 새로운 경우 ETA 행을 숨기고 다른 모든 상태에서 ETA 행을 숨기는 데 필요한 양식이 있습니다. 이것은 내가 뭘하려 :
var progress, ordered, unordered, completed, cancelled, reg, high, user, trimUser, etaDate, etaRow, etaHour, etaMinutes;
function initiate() {
//declaring necessary variables
declaration()
}
function declaration(){
//Declaration of variables for status changes
sNew = $("option[value='New']");
progress = $("option[value='In Progress']");
ordered = $("option[value='Ordered']");
unordered = $("option[value='Unordered']");
completed = $("option[value='Completed']");
cancelled = $("option[value='Cancelled']");
//Declaring variables for priority changes
reg = $('input[value="ctl00"]');
high = $('input[value="ctl01"]');
//Declaring current user using SPServices
user = $().SPServices.SPGetCurrentUser({
fieldName: "Name",
debug: false
});
//Declaring variables for ETA field manipulation
etaRow = $("nobr").filter(function() { return $.trim(this.childNodes[0].nodeValue) === "ETA"; }).closest("tr");
etaDate = $('input[title="ETA"]');
etaHour = $("[id$=DateTimeFieldDateHours]");
etaMinutes = $("[id$=DateTimeFieldDateMinutes]");
}
function hideETA(){
//hide ETA options
etaRow.hide();
if(sNew.not(:checked)){
alert('CP1');
eta.show();
}
}
그래서 방법 나는 그것이 새로운 아무것도하지만의 당시 때, (새가 기본이기 때문에)는 처음에 그것을 숨겨했다 할 시도를 보여줍니다. 는 편집 : 내가 함께 @ 리차드의 도움 후 그것을 어떻게 내가 그것을 해결할 생각 , 이것은 내 if 문 및 선택기 :
function setETA(){
//Hide, Display and Disable ETA based on stages
if(sNew.is(":checked")){
etaRow.hide();
}else if (progress.is(":checked")){
//do nothing, should be already showing
}else{
etaDate.attr("readonly","true").css('background-color','#F6F6F6');
etaHour.attr("disabled","disabled");
etaMinutes.attr("disabled","disabled");
}
}
바로 박쥐, 변경'(sNew.not가 (: 선택))의 경우''에있는 경우 :'(sNew.is (!)가 "확인"). 따옴표를 추가하고 .is() ... – Richard
을 사용하십시오. 궁금 해서요. 그게 .not()이 뭐니 뭐니해도, 나는 똑같은 줄 알았는데 – Batman
그럼 실제 HTML은 무엇입니까? –