1

I have a multiple selection field in a SharePoint list called "Electronic Document", when users select "Microsoft" from the choice, they want to see another fields, I have used jquery but didn't work, please help

here is the code

$("input[name='Electronic_x0020_Documents_4036b3bd-2b91-499d-93b1-dd7066f7223e_$MultiChoice']").on("click", function() {

        if($(this).val() == 'Microsoft Documents')
        {
            $('nobr:contains("Other Documents")').closest('tr').show();
                    }else{
            $('nobr:contains("Other Documents")').closest('tr').hide();
        }
    });

2 Answers 2

0

Try this :

<script type="text/javascript" src="/_layouts/1033/jquery-1.4.4.min.js"></script> //Or Get refer it from "<aclass="vglnk"     href="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" rel="nofollow"><span>http</span><span>://</span><span>ajax</span><span>.</span><span>googleapis</span><span>.</span><span>com</span><span>/</span><span>ajax</span><span>/</span><span>libs</span><span>/</span><span>jquery</span><span>/</span><span>1</span><span>.</span><span>3</span><span>/</span><span>jquery</span><span>.</span><span>min</span><span>.</span><span>js</span></a>"

<script type="text/javascript">

 $(document).ready(function()

 {
     //alert('jQuery Works');



  //Hide Reason fields initially 

  $("textarea[title$='Electronic Document']").parent('span').parent ('td').parent('tr').hide();



 //Associate a function with Drop down change event

  $("select[title$='Electronic Document:']").change(function()

  {

    if($(this).val()=='Microsoft')

     {

       $("textarea[title$='Electronic Document']").parent('span').parent    ('td').parent('tr').show();

     }

    else

     {

   $("textarea[title$='Electronic Document']").parent('span').parent ('td').parent('tr').hide();

     }

 });

 });

</script>
0

Try the below one, and replace the field names with your fields

$(document).ready(function(){
//Show/hide columns based on Choice Field Selection
$("select[title='City']").change(function() {
if ($("select[title='City']").val() != "other")
{
$('nobr:contains("OtherCity")').closest('tr').hide();
}
else
{
$('nobr:contains("OtherCity")').closest('tr').show();
}
});
});

Check the detail steps at

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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