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

268
Views
¿Cómo paso el botón como parámetro a una función?

Tengo una función que llama a otra función. Mi objetivo es pasar el botón como parámetro a otra función.

 function A(){ var btn = $find("<%=btnX.ClientID %>"); B(btn); } function B(*btn parameter here*){ //I need button here }
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Ni siquiera tienes un problema, ya que ya debería funcionar...

 function A(){ // var btn = $find("<%=btnX.ClientID %>"); btn = "test" // remove this "test" line B(btn); } function B(button){ //I need button here console.log(button) } A()

about 4 years ago · Juan Pablo Isaza Report

0

Debería funcionar. ¿Ves algún error allí?

 function A(){ var btn = $find("<%=btnX.ClientID %>"); B(btn); } function B(button){ // Do with that button whatever you want here. Eg button.style.color = 'cyan'; } A()

about 4 years ago · Juan Pablo Isaza Report

0

Prueba esto con cualquier selector. debería funcionar

 function A(){ var btn = "#btn"; B(btn); } function B(button){ // Do with that button whatever you want here. Eg var btn = document.querySelector(button); btn.style.backgroundColor = 'red'; btn.style.color = 'white'; } A(); 

 function A(){ var btn = "#btn1"; B(btn); } function B(button){ // Do with that button whatever you want here. Eg var btn = document.querySelector(button); console.log(button); btn.style.backgroundColor = 'red'; btn.style.color = 'white'; } A();
 <button id="btn0">click button</button> <button id="btn1">click button</button>

about 4 years ago · Juan Pablo Isaza Report
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!