File attach

Upload files or attachments.

How to use?

To add hs.file-attach.js in your page, add a .js-custom-file-attach class to the input tag.

Copy-paste the following <script> near the end of your pages under JS Front to enable it.

                  <script src="../../assets/js/components/hs.file-attach.js"></script>

Copy-paste the init function under JS Plugins Init., before the closing </body> tag, to enable it.

                    $(document).on('ready', function () {
                      // initialization of file attach module

Basic example

                        <!-- File Attachment Input -->
                        <label class="file-attachment-input py-8" for="floorplanAttachmentInput">
                          <span class="d-block mb-2">Upload floorplan</span>
                          <small class="d-block text-muted">Maximum file size is 1MB</small>
                          <input id="floorplanAttachmentInput" name="images-attachment" type="file" class="js-custom-file-attach file-attachment-input__label"
                          <span id="floorplanFileUploadText"></span>
                        <!-- End File Attachment Input -->

JavaScript behavior


Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-result-text-target="".

Attribute Description


ID of the element to which the file name will be displayed.
Contact Us