0

i used next code in my custom form of document library

 `<script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript&quot;"></script><script type="text/javascript">`

$(document).ready(function(){ // col1 is hidden by default , col2 is visible

$('nobr:contains("Вођа тима - одобрење")').closest('tr').hide();

// Show/hide columns based on Drop Down Selection

// hide col2 and show col1 when selecting "dropdown option 1"

$("select[title='Обрађивач - одобрење']").change(function() { if ($("select[title='Обрађивач - одобрење]").val() == "Да") { $('nobr:contains("Вођа тима - одобрење")').closest('tr').show(); $('nobr:contains("Врховни ревизор - одобрење")').closest('tr').show(); }

// hide col1 and show col2 when selecting "dropdown option 2"

else if($("select[title='Обрађивач - одобрење']").val() == "Не"){ $('nobr:contains("Вођа тима - одобрење")').closest('tr').hide(); $('nobr:contains("Врховни ревизор - одобрење")').closest('tr').hide(); } }); }); </script>

my html tag of cutom form is like on picture enter image description here

where is error?

  • 1
    would you mind organizing your code so we can read it better. I know you are new, and that is cool :) but if you put 4 spaces before your entry when you post, it will put it in "code view". Do this for each separate line to organize your code posting so it is easier for us to read. We can help better that way – lazoDev Apr 2 at 13:44
  • What exactly is the problem you are experiencing? Does your initial hiding of "col1" work? Have you put an alert or console.log inside your change handler to be sure that it is registering the change in drop down value? – Dylan Cristy Apr 2 at 15:11
  • Hiding of field is not working – gogi100 Apr 2 at 15:16
  • sorry i edited code based on my solution, but this code is not working – gogi100 Apr 2 at 19:43
  • @Dylan Cristy i put alert in my code in else if($("select[title='Обрађивач - одобрење']").val() == "Не"){ $('nobr:contains("Вођа тима - одобрење")').closest('tr').hide(); $('nobr:contains("Врховни ревизор - одобрење")').closest('tr').hide(); } but my code does not give me alert – gogi100 Apr 3 at 6:04

Your Answer

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

Browse other questions tagged or ask your own question.