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

149
Views
Quiero obtener Origin de mi entrada con la identificación "input_search". ¿Cómo puedo hacerlo?

Así que traté de resolver este problema haciendo

document.getElementbyId('seach_input') pero no funciona

aquí mi código:

 var autocomplete = new google.maps.places.Autocomplete(document.getElementById("search_input"), { componentRestrictions: {'country' : ['AT']}, fields: ['geometry', 'name'], types: ['establishment', 'geocode'] }) var directionsService = new google.maps.DirectionsService(); var request = { origin : 'Imst, Österreich', // a city, full address, landmark etc destination : 'Innsbruck, Österreich', travelMode : google.maps.DirectionsTravelMode.DRIVING }; function getRoute(){ directionsService.route(request, function(response, status) { if ( status == google.maps.DirectionsStatus.OK ) { document.getElementById('preis').value = Math.round(response.routes[0].legs[0].distance.value / 1000 * 2) // the distance in metres } else { // oops, there's no route between these two locations // every time this happens, a kitten dies // so please, ensure your address is formatted properly } }); }
 <input type="text" required="" class="inputText" id="search_input" name="o" placeholder="Abholort"> <br> <input type="text" name="preis" readonly="" class="inputText" id="preis" placeholder="preis"><br> <button id="preisA" onclick="getRoute()" class="toggle-btn">Preis ausrechnen!</button>

quiero en var solicitar que el texto de origen sea el valor del texto de entrada con el id "search_input" ¿cómo puedo hacerlo?

about 4 years ago · Santiago Trujillo
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!