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

175
Views
El parámetro de cadena pasado en javascript no funciona

Solo trato de entender lo que está pasando aquí. Obviamente, una peculiaridad de javascript, con la esperanza de que alguien pueda ayudar a explicar.

HTML:

 <input type="file" asp-for="TitleImageUrl" value="@_loc[Model.AddTitleImageButton]" onchange="preview('CardDynamicImage')" /> <img class="card-img-top embed-responsive-item" id="CardDynamicImage" src="@Model.CardTitleImage" onerror="this.src=''">

JAVASCRIPT QUE FUNCIONA:

 function preview(elementId) { <!--The id of the element is hard coded directly. Ignore the value passed in.--> CardDynamicImage.src = URL.createObjectURL(event.target.files[0]); } }

JAVASCRIPT QUE NO FUNCIONA: ¿Por qué?

 function preview(elementId) { <!--Trying to pass in the id of the element does not work.--> elementId.src = URL.createObjectURL(event.target.files[0]); }
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!