Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
¿Cómo puedo duplicar esta función .JS en varios elementos en la misma página de Wix?

Básicamente, lo que estoy preguntando aquí es: "¿Cómo creo dos botones que hacen lo mismo en la misma página de Wix?"

He agregado un código personalizado para crear una función de texto desplegable para cuando alguien haga clic en "Leer más".

Mi problema es que he definido cada botón individual (total de 4 botones) y su función así:

 $w.onReady(function () { // Write your JavaScript here // column1 $w("#readMoreButton1").onClick(() => { $w("#readMoreStatebox1").changeState("expandedState1"); }); $w("#readLessButton1").onClick(() => { $w("#readMoreStatebox1").changeState("collapsedState1"); }); //column2 $w("#readMoreButton2").onClick(() => { $w("#readMoreStatebox2").changeState("expandedState2"); }); $w("#readLessButton2").onClick(() => { $w("#readMoreStatebox2").changeState("collapsedState2"); }); //column3 $w("#readMoreButton3").onClick(() => { $w("#readMoreStatebox3").changeState("expandedState3"); }); $w("#readLessButton3").onClick(() => { $w("#readMoreStatebox3").changeState("collapsedState3"); }); //column4 $w("#readMoreButton4").onClick(() => { $w("#readMoreStatebox4").changeState("expandedState4"); }); $w("#readLessButton4").onClick(() => { $w("#readMoreStatebox4").changeState("collapsedState4"); }); // To select an element by ID use: $w('#elementID') // Click 'Preview' to run your code });

Leer más/Leer menos Característica

El resultado final es que el primer botón/columna funciona pero el resto no. He intentado cambiar la sintaxis, pero me temo que me estoy perdiendo algo muy simple. ¿Puedo obtener ayuda con esto?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!