Hello devs,
I have less experience with Javascript. Can someone help me out? Because I don't now how to achieve a second yes or no colomn and hide section part. I can but then the first stops working:)
This works good:
$(document).ready(function() {
console.log(555, "JS-hiding elements");
$(".tab-title").hide();
});
$(document).ready(function () {
debugger;
onDisplaySectionChange();
showHideFieldsandTab();
});
function showHideFieldsandTab() {
$("#bij_factuuradresanders").change(onDisplaySectionChange);
}
function onDisplaySectionChange() {
var selectedValue = GetRadioSelectedValue($('#bij_factuuradresanders'));
if (selectedValue != "0") {
$("table[data-name='tab_2_section_4']").parent().show(); /// and .hide();
}
else {
$("table[data-name='tab_2_section_4']").parent().hide(); /// and .hide();;
}
}
GetRadioSelectedValue = function(input) {
if (!!$(input).find("input[type=radio]")) {
var controlName = $(input).find("input[type=radio]").first().attr("name");
if (!!controlName) {
return $("input[name='" + controlName + "']:checked").val();
}
}
return "";
};
But now I want to add another, this one (if I paste below then only this one work):
function showHideFieldsandTab() {
$("#bij_tweedereferentienummeropgeven").change(onDisplaySectionChange);
}
function onDisplaySectionChange() {
var selectedValue2 = GetRadioSelectedValue($('#bij_tweedereferentienummeropgeven'));
if (selectedValue2 != "0") {
$("table[data-name='tab_2_section_7']").parent().show(); /// and .hide();
}
else {
$("table[data-name='tab_2_section_7']").parent().hide(); /// and .hide();;
}
}
Thank you so much