search

Home  >  Q&A  >  body text

button missing

So I should make a calculator today, a web calculator with JS on it, CSS and so on. I recently rewrote all the JS cries and rechecked some things. Now the calculator button is gone.

I wish the website had a calculator on the page that it used to have buttons for. Weirdly aligned, but still a button. But all I did was change a small part of the HTML code and now the button disappears.

Copy: https://replit.com/@MiguelBaltazar1/epicalculator

P粉521013123P粉521013123354 days ago491

reply all(1)I'll reply

  • P粉106711425

    P粉1067114252024-01-17 17:27:16

    You need to set the "keys" class as a child element of the div element with the id "calculator". Below is the updated HTML that fixes the issue.

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8" />
        <title>Calculator, apparently</title>
        <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    
    <body onload="load()">
        <header class="header">
            <h1>this is a calculator.</h1>
        </header>
        <div id="calculator">
            <div class="top">
                <span id="clear">C</span>
                <div id="screen">1234567890</div>
            </div>
            <div class="keys">
                <span>7</span>
                <span>8</span>
                <span>9</span>
                <span class="operator">+</span>
                <span>4</span>
                <span>5</span>
                <span>6</span>
                <span class="operator">-</span>
                <span>1</span>
                <span>2</span>
                <span>3</span>
                <span class="operator">÷</span>
                <span>0</span>
                <span>.</span>
                <span class="eval">=</span>
                <span class="operator">x</span>
            </div>
            <script type="text/javascript" src="script.js"></script>
    </body>
    
    </html>

    reply
    0
  • Cancelreply