Jump to content

Ian_A

Circle Member
  • Posts

    8
  • Joined

  • Last visited

Posts posted by Ian_A

  1. Here is the jQuery solution I use to accomplish this:

     

    <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script> 

      <script>
        // Function to replace image-slide-title content with alt tag for images within sqs-gallery-container using jQuery
        $(document).ready(function() {
          $('.sqs-gallery-container img').each(function(index) {
            $('.image-slide-title').eq(index).html($(this).attr('alt').replace('.jpg', ''));
          });
        });
      </script>

  2. Old topic, but incase anyone is still in need of a solution, here is how I do it with jQuery.

    I apply the code per page as I only use it on specific gallery pages made for client previews.

     

    <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>

    <script>
        // Function to replace image-slide-title content with alt tag for images within sqs-gallery-container using jQuery
        $(document).ready(function() {
          $('.sqs-gallery-container img').each(function(index) {
            $('.image-slide-title').eq(index).html($(this).attr('alt').replace('.jpg', ''));
          });
        });
      </script> 

  3. On 3/17/2023 at 11:16 PM, Peeper said:

    How would I get this to work if I have multiple forms on my website? Would there be a way for each form to have a unique subject line? 

    Thank you so much for the help!

    This will only work on 1 form per page. 

    If your forms are all on different pages, then you should be able to apply it to each page individually and just change this line to give each one a unique subject line: 

    var subjecttxt = "#" + timecode;

    Replace # with whatever you want the subject to be prior to the timecode/date.

  4. 1 hour ago, TheMissingPastry said:

    Hi Ian_A,

    Would you be able to help walk me through how to input this correctly? I am having the same troubles as Jenny_M and would love to get this to work!

    @TheMissingPastry 

    1. Put a form on the page.

    2. Edit the order of the form fields to put the subject field at the very top.

    3. Save your changes. 

    4. Go to Page Settings > Advanced for the page with the form on it and paste all of the code from <script> to </script> into the page header code injection area. 
     

    That’s it. You should see the subject field when editing the page, but not when viewing it as a user. Submit a test of your form and it should have a unique # at the end now. 

  5. I use a similar method as Mochi, but I use Javascript to autofill the Subject field with a Unix Timestamp giving me a unique number at the end of each subject, then I set the CSS value of the form  Subject field and it's Label to none, making it invisible to the user. The Subject field has to be the first field of the form for this to work, as it has no defining attributes, so this simply modifies the 1st field. Seems to be working so far.

    PAGE HEADER CODE INJECTION

    <script>
    $(document).ready(function(){ 
        var timecode = Date.now();
        var subjecttxt = "#" + timecode;
      
      $('form').find("input[type=text], text").each(function()
      {
          if(!$(this).val()) { 
         $(this).attr("value", subjecttxt);
         $(this).attr("readonly", true);
         $(this).css("display","none");
            var val = subjecttxt;
            return ( val !== subjecttxt );
      }
      });
    });

      $(document).ready(function(){ 
    $('form').find("label[class=title]").each(function()
      {
          if(!$(this).val()) { 
         $(this).css("display","none");
            var val2 = "none";
            return ( val2 !== "none" );
      }
      });
    });  
     </script>

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.