We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Changing html text with puzzles

Home Forums Puzzles Changing html text with puzzles

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #67425


    Tried using “Set prop” puzzle targeting an html text element with a specific id, but it didn’t work.

    The example shown in Soft8Soft’s manual shows a specific property called “textContent” being used. However, this prop is not listed in the puzzle. I tried the “innerHTML” prop, but it also didn’t work.

    The app link is: https://cdn.soft8soft.com/AROAJSY2GOEHMOFUVPIOE:8b1dc361cf/mesa_de_cabeceira_lumi/index.html

    I’ve also attached a screenshot of the puzzles I’m trying to use at the moment.

    The text I’m trying to change is the “R$ 2500” text. I’m following an adapted pricing logic taken from one of Soft8Soft’s examples, which is used in a Scene text object. However, I need to do the same thing using an HTML text element, rather than a Scene text object.

    Does anyone know how we can change HTML text using puzzles?

    You must be logged in to view attached files.

    The text I’m trying to change is the “R$ 2500” text

    You are trying to set innerHTML for the wrong element.

    The element you need have no id. Read about querySelector() and sequential requests or set some unique id for <p>.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.


    Tried setting the id “pricetag” to p in the index.html file (<p id=”pricetag”> R$ 2500 </p>) but it still didn’t work.

    I’m trying to learn about querySelector and did a few tries, calling <p> content via type (“p”), id (“#pricetag”) and class (“.pricetag”) in the querySelector puzzle. None of them worked.

    I also tried placing a JS exec script puzzle with the following code:

    var x = document.getElementById(“texto_preco”);
    x.querySelector(“p”).innerHTML = “Hello World!”;

    That also didn’t work.

    What could I be missing?
    Thanks for the help once again.


    Update for future reference:

    I set the ID “pricetag” to the <p> element in the HTML file and it worked when the Set Prop puzzle was by itself. It wasn’t working when it was inside the price_recount procedure created to update product price based on client selections in the configurator.

    The reason it wasn’t working is because the procedure was set, but not called.

    Now everything seems to be working correctly. Thanks again for the help!

    • This reply was modified 8 months, 1 week ago by PolyPixl.
    You must be logged in to view attached files.
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.