Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
jacobtdb

Change text "Select" in product detail page

Question

11 answers to this question

Recommended Posts

  • 0

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>

 


You can send your question to my email to get faster answer. / How to Setup Password & Share URL 

-- I'm Tuan. I work for a non-profit project (build free libraries). I check the forum once or twice a day to help out the community. If you don't see me answering your question, you can send it to the email above. There are so many questions every day so I can't answer them all at once, I will try to answer them in the next few days.

Share this post


Link to post
  • 0
5 hours ago, jacobtdb said:

Thanks, but it seems not work. Any idea why? It is a webshop in 7.0 version

Can you keep above code & I will check again?

and which template do you use?


You can send your question to my email to get faster answer. / How to Setup Password & Share URL 

-- I'm Tuan. I work for a non-profit project (build free libraries). I check the forum once or twice a day to help out the community. If you don't see me answering your question, you can send it to the email above. There are so many questions every day so I can't answer them all at once, I will try to answer them in the next few days.

Share this post


Link to post
  • 0

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>

 


You can send your question to my email to get faster answer. / How to Setup Password & Share URL 

-- I'm Tuan. I work for a non-profit project (build free libraries). I check the forum once or twice a day to help out the community. If you don't see me answering your question, you can send it to the email above. There are so many questions every day so I can't answer them all at once, I will try to answer them in the next few days.

Share this post


Link to post
  • 0

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.


sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include.
Explore our range of Squarespace Extensions, including the Wishlist, Variant Availability and Datepicker Extension
Note that links in my posts may be affiliate links. Need personal help? 
Book a Squarespace Expert.

Share this post


Link to post
  • 0

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>

 

Share this post


Link to post
  • 0
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

Share this post


Link to post
  • 0
On 5/1/2020 at 3:10 PM, jacobtdb said:

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

Using it here fx:

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

Which code did you use?


You can send your question to my email to get faster answer. / How to Setup Password & Share URL 

-- I'm Tuan. I work for a non-profit project (build free libraries). I check the forum once or twice a day to help out the community. If you don't see me answering your question, you can send it to the email above. There are so many questions every day so I can't answer them all at once, I will try to answer them in the next few days.

Share this post


Link to post
  • 0
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>

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...