Help with js code to remove upload attachment box on submit request form | Community
Skip to main content

Help with js code to remove upload attachment box on submit request form

  • January 21, 2025
  • 1 reply
  • 0 views

Hi, 

 

Please forgive my lack of knowledge here. I've looked at the advice for hiding the upload attachment area of the ticket form on Guide on multiple threads and comments and have a bit of code that has worked for other users however it does not seem to work and the script has changed significantly since then and I can't see any newer guidance on how to hide this area. 

 

As per the guidance, I'm adding this code to my script.js 

 

// hide attachments 
if (window.location.href == "https://XXbrandURLXX.zendesk.com/hc/en-gb/requests/new?ticket_form_id=XXumber hereXX") { 
   $('.form-field label:contains("Attachments")').hide();
   $('#upload-dropzone').hide();

 

However in preview it is not working.  I can't switch off the option in overall settings as we still want attachments; I just don't want it on this specific form that sits on another brand within our ZD. 

1 reply

Elaine14
  • September 4, 2025
Hi Nicola,
 
Thank you for sharing the details of your issue.
 
The approach of using JavaScript in script.js to hide the attachments section on a specific ticket form can be tricky, especially with recent changes to Zendesk’s scripts and form structure. The selectors and script behavior may have evolved, which could cause the code to no longer work as expected.
 
Here are a few suggestions that might help:
 
  • Double-check that the form ID and brand URLs used in the script exactly match your current setup.
  • Inspect the page elements in your browser’s developer console to verify the current class names or IDs for the attachment fields, as these might have changed.
  • Consider using a more dynamic selector or event listener to ensure the code runs after the form has fully loaded.
  • If possible, explore Zendesk's newer customization options or apps that might support this functionality more robustly.
 
If you continue to face challenges, providing additional context or screenshots may help the community assist you further.
 
I hope this helps point you in the right direction!