If there is any posibility to add javascript to Sharepoint list edit form? I would like to hide/show field on form if other field has or hasn’t value. I tried use Power Apps but it isn’t working in real time (you have to save element end open it again to see that field was hidden). Have you any idea how to do this?

1 Answer 1


Yes it is possible using Javascript. Please try the below format.
Note: I have tested this in SharePoint 2016 Standard Edition.

$(document).ready(function() {
decideFunc();// to hide or show for new form
//the below code used for on change event of the text. Here am using input type text column as //Base Column.



function decideFunc(){

}//decideFunc ends
function hideColumn(){


$('input[id*="ColumnID"]').val("");//clear the value while hide

}//hideColumn ends
function showColumn(){


if(!$('input[id*="ColumnID"]' ).val().trim().length){

}//showColumn ends

  • How you applied this script? Using InfoPath or other solution?
    – Iwoo
    Commented Jun 14, 2019 at 7:28
  • Add the "Content Editor Webpart" by editing the list form. We can put the JS URL in that "Content Editor Webpart". Sorry i didn't have the the real-time experience in SharePoint 2019 Online. As per my research knowledge, You should enable the "Classic List Experience" under the "List Settings=> Advanced Settings", to edit the list forms.
    – Xavi
    Commented Jun 14, 2019 at 14:38
  • Unfortunetly, I think that there is no option like that with new SP2019 :(
    – Iwoo
    Commented Jun 26, 2019 at 10:02

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.