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

nekonote404

Member
  • Content Count

    4
  • Joined

  • Last visited

Posts posted by nekonote404


  1. It's a new site and it's not ready for public yet, but here it is.

    https://lychee-chiton-g4er.squarespace.com/rings/bague-branche-large

     

    So the site's original language is in French, and my code can convert certain words and phrases into English.

    As I set English as default language temporary, my code will run when page is loaded and it will translate the page into English automatically. At this point, the order button still works.

    However, if I click on the "fr" link at the top of the page, it will translate back the page to French, but the order button no longer works. The same code is run at page load, and it has no problem. I can't tell the difference.

    Thanks for helping me out. I really appreciate it.

     


  2. Thanks @colin.irwin

    Your code works too for executing the code on page loading. But, the problem that I'm having is when it's called from pressing a button. I don't know why, but it will disable the Add to Cart button. 

    Are we allowed to make changes to the template using Javascript?

    <ul id="lang-panel">
    	<li id="lang-btn-en" class="lang-btn" onclick="switchLang();"> en</li>
    </ul>
    
    ------------
    
    function switchLang () {
    	document.body.innerHTML = document.body.innerHTML.replace(/Bonjour/g, "Hello");
    }

     


  3. Hi, I'm trying to make a simple translation program using Javascript to replace certain words from French to English/English to French when pressing a button. I'm using innerHTML.replace to do this, and it works fine.

    document.body.innerHTML = document.body.innerHTML.replace(/Bonjour/g, "Hello");

     

    However, in the Product detail page, the Add to Cart button stops working after running the code. The same code runs at the page load, and it's fine. It has no affect on the Add to Cart button. 

    window.addEventListener('DOMContentLoaded', function() {
    	document.body.innerHTML = document.body.innerHTML.replace(/Bonjour/g, "Hello");
    })

     

    This problems occur only when the code is called from a button.

     

    Could anyone help me? Sorry, my client's site is not published yet, so I cannot show you the actual site.

     

     

×
×
  • Create New...