File Attach

How to use?

Copy-paste the following <script> near the end of your pages under JS Nova 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.

            
              <script>
                $(document).on('ready', function () {
                  // initialization of file attach module
                  $.HSCore.components.HSFileAttach.init('.js-custom-file-attach');
                });
              </script>
            
          

Basic example

                  
                    <!-- File Attach -->
                    <form action="/">
                      <label class="link d-flex align-items-center font-weight-semi-bold mb-0">
                        <input class="js-custom-file-attach d-none" type="file"
                               data-result-text-target="#fileUploadText">
                        <i class="nova-export icon-text mr-2"></i>
                        <span class="cursor-pointer" id="fileUploadText">Upload</span>
                      </label>
                    </form>
                    <!-- End File Attach -->
                  
                

Methods

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
data-result-text-target ID of the element to which the file name will be displayed.