0

I have a field "Manager" (radio button with value yes and no) and another field country(dropdpwn) If I select manager = yes then only country should display else it should be hidden when user go to new form.

Below is my code, please let me know where I am doing wrong.

$("select[title='Manager]").change(function() {
if ($("select[title='Geographical span']").val() == "Yes")
{
$('nobr:contains("Country")').closest('tr').show();
}
0

I would recommend you to use SPUtility.js to Hide/Show SharePoint list fields.

Updated Code:

$("select[title='Manager]").change(function() {         
if (SPUtility.GetSPField("Geographical span").GetValue() == "No"){              
    SPUtility.GetSPField("Country").Hide();
}
else{
    SPUtility.GetSPField("Country").Show();
}
});

Source for SPUtility.js : https://github.com/kitmenke/sputility/blob/master/src/sputility.js

Note : You have to include reference for SPUtility.js file in your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.