Я создаю пользовательский список sharepoint и написал некоторую логику jQuery для скрытия / отображения / очистки полей ввода данных, выпадающих списков и дат. Мне нужно изменить выпадающие меню на переключатели для да / нет , и я не могу понять, как изменить свои операторы if в логике jQuery, я написал для переключателей и проверил их значения.
Кто-нибудь знает, что я могу настроить группы радиокнопок с помощью jquery и получить значение, которое отмечено?
Я пытался нацелиться на них с помощью
if($("input[title='Did the Rep call a TM prior to start of shift or leaving for the day?']:checked").val() == "No")
- это не сработало.
$("input[title='Did the Rep call a TM prior to start of shift or leaving for the day?']:checked").change(function() {
if ($("input[title='Did the Rep call a TM prior to start of shift or leaving for the day?']:checked").val() == "No"){
// *******************************Show accountability created? question***********************************
$('nobr:contains("Accountability discussion created?")').closest('tr').show();
// *******************************Reset values from previous "Yes" selection*****************************
$("select[title='Did the Rep report there was an issue with MyWorkLife?']").val("Select Yes or No");
$("select[title='Did the rep send screenshots?']").val("Select Yes or No");
// *******************************Hide questions from previous "Yes" selection***************************
$('nobr:contains("Did the Rep report there was an issue with MyWorkLife?")').closest('tr').hide();
$('nobr:contains("Did the rep send screenshots?")').closest('tr').hide();
}
}```
I expect these different rows in the table to either be shown or hidden when the if statement is met - this is only partial code there is "else if" and "else" statements after but didn't think necessary to paste it all.