How to make the Title and task one under one?

  • 0
    It comes out like this.
    It should be like this.
    CODE:
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <body>
        <input type="text" class="input"><br>
        <br>
        <textarea class="text"></textarea>
        <button class="read">Вывести</button>
        <h3 class="out"></h3>
    
        <script type="module" src="script.js"></script>
        <script type="module" src="listScript.js"></script>
    </body>
    </html>

    let button = document.querySelector('.read');
    button.onclick = () =>{
        fan1();    
    }; 
    
    let todoList  = [];
    let heaList = [];
     function fan1 () {
        
        let text = document.querySelector('.text');
        let temp  = {};
        temp.todo = text.value;
        temp.check = false;
        let i = todoList.length;
        todoList[i] = temp;
        //result.innerHTML = temp.todo;      
        out();
     }
        function out() {
            let input = document.querySelector('.input').value;
            let result = document.querySelector('.out');
            let name  = {};
            name.todo = input;
            name.check = false;
            let j = heaList.length;
            heaList[j] = name;
    
            let out = '',
            res = '', res2 = '';
    
            for (let key in todoList) {
                
                    res2+=todoList[key].todo + '<br>';
            }   
            for (let key1 in heaList) {
                
                res+=heaList[key1].todo + '<br>';       
     }   
     out += '<span>'+ res + res2 + '</span><br>'
     result.innerHTML = out;                      // heaList[j].todo + '<br>' + todoList[i].todo + '<br>'
        }
    JavaScript Anonymous, May 12, 2019

  • 3 Answers
  • 0
    Perhaps so (not sure if I understood correctly):

    function out() {
    let input = document.querySelector('.input').value;
    let result = document.querySelector('.out');
    let name = {};
    name.todo = input;
    name.check = false;
    let j = heaList.length;
    heaList[j] = name;

    let out = '', res = '';

    for (let key in todoList) {
    res += heaList[key].todo + '<br>';
    res += todoList[key].todo + '<br>';
    }
    result.innerHTML = '<span>' + res + '</span><br>';
    }
    Mia Savage

  • 0
    if I understand correctly, you can do this

    Anonymous

  • 0
    Do you mean one width or something? Add classes and give one width, you can of course play with bootstrap, or you can set flexes natively
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!