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

242
Views
Blazor - updating input text control by java script - app doesn't see that

At the blazor (server) app, I have input text. Something like that:

<input id="SearchPoint" Class="form-control" 
@bind="@searchPoint" @bind:event="onchange" />

To get the current location I'm using js and updating that control directly:

document.getElementById("SearchPoint").value = pos.coords.latitude + 
', ' + pos.coords.longitude

Problem is that although on-screen there is a new value still app doesn't see that new updated value and use the previous one like an update by js didn't happen.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Triggering event "onchange" solved the problem (based on answer @andy-e How can I trigger an onchange event manually?)

if ("createEvent" in document) {
     var evt = document.createEvent("HTMLEvents");
     evt.initEvent("change", false, true);
     document.getElementById("SearchPoint").dispatchEvent(evt);
 }
 else
     document.getElementById("SearchPoint").fireEvent("onchange");
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!