Jump to content

Change text "Select" in product detail page

Recommended Posts

  • Replies 16
  • Views 1.5k
  • Created
  • Last Reply
Posted

Add to Code Injection Footer

<script>
  jQuery(function($){
$("select option").html(function() { 
          return $(this).html().replace("Select", "tuan");  
    });
});
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted

remove above and use this

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
  $(document).ready(function() { 
		$("select option").html(function() { 
          return $(this).html().replace("Select", "tuan");  
    });
	});
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted

I don't want to be the bearer of bad news, but that solution will appear to work when logged on, and when the page is refreshed, but it won't work for visitors who navigate to the page from another page on your site. This is because the document.ready function will not fire when this template loads a new page (see Ajax). For example, this is what I see:

1807761671_Screenshot2020-04-02at13_23_44.png.99d9a76a81249a64481d8a78ec0080ee.png

Replacing it with the onInitialize function will fix this.

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Posted

Thanks. You are right. I tried this code and it seems like this works. 

 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
  window.Squarespace.onInitialize(Y, function(){  
		$("select option").html(function() { 
          return $(this).html().replace("Select", "Vælg");  
    });
	});
</script>

 

  • 4 weeks later...
Posted
On 4/2/2020 at 2:31 PM, paul2009 said:

I don't want to be the bearer of bad news, but that solution will appear to work when logged on, and when the page is refreshed, but it won't work for visitors who navigate to the page from another page on your site. This is because the document.ready function will not fire when this template loads a new page (see Ajax). For example, this is what I see:

1807761671_Screenshot2020-04-02at13_23_44.png.99d9a76a81249a64481d8a78ec0080ee.png

Replacing it with the onInitialize function will fix this.

Any idea of why this code does´nt work in 7.1 ?

Using it here fx:

https://www.lindbikeparts.dk/webshop/marconi-collection-1

Posted
On 5/2/2020 at 4:43 PM, tuanphan said:

Which code did you use?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
  window.Squarespace.onInitialize(Y, function(){  
		$("select option").html(function() { 
          return $(this).html().replace("Select", "Vælg");  
    });
	});
</script>
  • 1 year later...
Posted
On 3/26/2020 at 3:44 PM, tuanphan said:

Add to Code Injection Footer


<script>
  jQuery(function($){
$("select option").html(function() { 
          return $(this).html().replace("Select", "tuan");  
    });
});
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

 

@tuanphan Your solution works perfectly, however, on mobile the word SELECT still pops up. Do you have an idea how to solve this issue?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.