How to hide field in any doctype using css

frappe.ui.form.on('Your DocType', {
  refresh: function (frm) {
    const elements = document.querySelectorAll('.transactions .document-link');
    elements.forEach((element, index) => {
      if (index !== 0) {
        element.style.display = 'none';
      }
    });)
    console.log(elements[0]);
  }
});

Try this to hide your field.

1 Like

Why create complexity? If you want to hide the field, go to Customize Form and check “Hidden.”

You are absolutely right. This is something where, if you don’t want to show connections under the document, we have an option called ‘Connection’ that allows you to jump to the linked doctype. Sometimes you might not want to show extra or unnecessary connections, and in that case, you can use this snippet to hide your connections. My bad— the title of this discussion doesn’t match.