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

78
Views
I have some errors in this source

I need run this code and solv all problems in it. tell me the problems , and how to solv it. project: How do I show the number of the letter's place in English, for example, if the user wrote a and pressed the button, the number 1 appears, and if wrote b, it appears 2 and so on. the code:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alpha Position Finder</title>
<script>
let alphabets=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
document.addEventListener('DOMContentLoaded',function() {
document.querySelector("button").onclick = finder;
function finder() {;
var check = document.getElementById('text').innerHTML;
}
}
</script>
</head>
<body>
<div>
<h1>Welcome to alpha position finder.</h1>
<p id="position"></p>
<input type="text" placeholder="Enter alphabet" id="text">
<button>Find</button>
</div>

</body>
</html>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to make the marked changes below for your code work. Read about Array.indexOf to understand how it works.

let alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];

document.addEventListener('DOMContentLoaded', function() {

  document.querySelector("button").onclick = finder;

  function finder() {

    var check = document.getElementById('text').value; // <-- CHANGE

    console.log("indexOf( " + check + ") = " + alphabets.indexOf(check) ); // <-- ADD

  }
});
<div>
  <h1>Welcome to alpha position finder.</h1>
  <p id="position"></p>
  <input type="text" placeholder="Enter alphabet" id="text">
  <button>Find</button>
</div>

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!