How can I make the form fill with its corresponding information from the database when it’s displayed?

I have a local project in which I edit the fields inserted in the database through a form, and the information should appear in the form because in DevTools > Network, the status shows that the data has been returned in JSON format and I can see its content.

    <form id="frmInventariosU">
      <input type="text" id="idinventarioU" hidden="" name="idinventarioU">
      <label>Articulo</label>
      <input type="text" class="form-control" id="nombre_articuloU" name="nombre_articuloU">
      <label>Tipo Modelo</label>
      <input type="text" class="form-control" id="tipo_modeloU" name="tipo_modeloU">
      <label>Color</label>
      <input type="text" class="form-control" id="colorU" name="colorU">
      <label>Marca</label>
      <input type="text" class="form-control" id="marcaU" name="marcaU">
      <label>Medida</label>
      <input type="text" class="form-control" id="medidaU" name="medidaU">
      <label>Existencia</label>
      <input type="text" class="form-control" id="existenciaU" name="existenciaU">
      <label>Entrada</label>
      <input type="text" class="form-control" id="entradaU" name="entradaU">
      <label>Salida</label>
      <input type="text" class="form-control" id="salidaU" name="salidaU">
    </form>

    <script type="text/javascript">
        function agregaDatosInventario(idinventario){

            $.ajax({
                type:"POST",
                data:"idinventario=" + idinventario,
                url:"../procesos/inventario/obtenDatosInventario.php",
                success:function(r){
                    dato=jQuery.parseJSON(r);
                    $('#idinventarioU').val(dato['id_inventario']);
                    $('#nombre_articuloU').val(dato['nombre_articulo']);
                    $('#tipo_modeloU').val(dato['tipo_modelo']);
                    $('#colorU').val(dato['color']);
                    $('#marcaU').val(dato['marca']);
                    $('#medidaU').val(dato['medida']);
                    $('#existenciaU').val(dato['existencia']);
                    $('#entradaU').val(dato['entrada']);
                    $('#salidaU').val(dato['salida']);
                }
            });
        }
</script>

This code returns the JSON I see in DevTools > Network with the data that should be inside the form

<?php

    require_once "../../clases/Conexion.php";
    require_once "../../clases/Inventario.php";

    $obj = new inventario();
    
    echo json_encode($obj->obtenDatosInventario($_POST['idinventario']));

?>

The function returns an array with the information

    public function obtenDatosInventario($idinventario){
      $c= new conectar();
      $conexion=$c->conexion();
    
      $sql="SELECT id_inventario, 
              nombre_articulo,
              tipo_modelo,
              color,
              marca,
              medida,
              existencia,
              entrada,
              salida
        from inventario";
      $result=mysqli_query($conexion,$sql);
      $ver=mysqli_fetch_row($result);
    
      $datos=array(
          'id_inventario' => $ver[0],
          'nombre_articulo' => $ver[1],
          'tipo_modelo' => $ver[2],
          'color' => $ver[3],
          'marca' => $ver[4],
          'medida' => $ver[5],
          'existencia' => $ver[6],
          'entrada' => $ver[7],
          'salida' => $ver[8]
            );
      return $datos;
    }

I suspect it’s an issue with the IDs, but I still can’t figure out how to fix it.
Any idea what the problem might be? Thanks in advance.

Can I use :hover on an element that is invisible but still takes up space?

I’m experimenting with CSS and came across an edge case I’m curious about.

Suppose I have a div> that is styled to be completely invisible, either via opacity: 0 or visibility: hidden, but it’s still present in the DOM and occupies layout space (or is absolutely positioned). I want to know if it’s possible to trigger a :hover effect on such an element.

Here’s a simple example:

.hover-target { width: 100px; height: 100px; background-color:
red; opacity: 0; /* Or visibility: hidden; */ position: absolute;
}
.hover-target:hover { background-color: green; opacity: 1; }

What I want to know:
Will :hover work on an element that’s invisible via opacity: 0 or visibility: hidden?

Is there a difference between opacity: 0 and visibility: hidden in terms of how they interact with pointer events like :hover?

If it doesn’t work, is there any CSS-only workaround to make an element invisible (visually) but still respond to hover events?

I know display: none completely removes the element from the rendering tree, so it’s not hoverable. But what about these subtler cases?

Thanks in advance for your insights!

encountered issues when to run my project (vite) [closed]

failed to load config from C:UsersUSERDesktopprojectspersonal-webvite.config.ts
error when starting dev server:
Error: spawn EFTYPE
at ChildProcess.spawn (node:internal/child_process:420:11)
at Object.spawn (node:child_process:753:9)
at ensureServiceIsRunning (C:UsersUSERDesktopprojectspersonal-webnode_modulesesbuildlibmain.js:1987:29)
at build (C:UsersUSERDesktopprojectspersonal-webnode_modulesesbuildlibmain.js:1885:26)
at bundleConfigFile (file:///C:/Users/USER/Desktop/projects/personal-web/node_modules/vite/dist/node/chunks/dep-Bxmd1Uxj.js:49196:24)
at async bundleAndLoadConfigFile (file:///C:/Users/USER/Desktop/projects/personal-web/node_modules/vite/dist/node/chunks/dep-Bxmd1Uxj.js:49180:19)
at async loadConfigFromFile (file:///C:/Users/USER/Desktop/projects/personal-web/node_modules/vite/dist/node/chunks/dep-Bxmd1Uxj.js:49144:44)
at async resolveConfig (file:///C:/Users/USER/Desktop/projects/personal-web/node_modules/vite/dist/node/chunks/dep-Bxmd1Uxj.js:48640:24)
at async _createServer (file:///C:/Users/USER/Desktop/projects/personal-web/node_modules/vite/dist/node/chunks/dep-Bxmd1Uxj.js:38250:18)
at async CAC. (file:///C:/Users/USER/Desktop/projects/personal-web/node_modules/vite/dist/node/cli.js:753:20)

PHP page – opening a youtube link in a lightbox window

I am looking to open a youtube video on a page in a jquery.fancybox.js window, it was working fine in html, but switching to .php the video doesn’t load in the jquery.fancybox.js window and doesn’t play…any suggestions?

this is the current code with a link to a youtube video

<! ---   link to open youtube video - vid used is an example -->

<div class="image">
<img src="images/video-thumb.jpg" alt="watch repair video thumbnail">
<a href="https://youtube.com/shorts/BklzhlqN9Z0?si=S0x0f6pp4iMo0lgC" class="overlay-link play-now" data-fancybox="gallery" data-caption=""><span class="flaticon-play-button"></span> </a>
<span class="ripple"></span>
</div>

please let me know if more information is needed?

Looking to insert html with image and embed code textbox in results window of a quiz results when score of 100% is acheived [closed]

Expected to happen: When getting a 100% result in quiz a “prize” is displayed below the remarks which includes an image and embed code

What actually happened: It either did not work at all or it inserted it for all results and not just when full score is achieved.

I am very very new to programming so I am very out of my depth here, but I feel like this should be possible, however when trying to adjust the code it broke or did nothing at all.

Minimal Reproducible Example on codepen: https://codepen.io/Ariane-the-sasster/pen/qEdMEQN

Desired Behaivour: When the “Quiz Complete” window pop-up appears for the HTML below to be appended into the “remarks” below the rest of the information and above the “Confirm button”

HTML I want to be displayed in pop-up window (.modal-content-container) when 100% result is achieved

<a href="https://arianami.neocities.org/CatCafe.html"><img src="https://files.catbox.moe/wg0rom.gif"></a>
  <textarea style="width:88px; height:31px; overflow:auto; padding:5px;"><a href="https://arianami.neocities.org"><img src="https://files.catbox.moe/wg0rom.gif"></a></textarea>

HTML

    <!DOCTYPE html>
  <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Naru chan's Cat Cafe</title>
      <link rel="stylesheet" href="style.css">
    </head>
    <body>
<body onload="NextQuestion(0)">
    <main>
        <!-- creating a modal for when quiz ends -->
        <div class="modal-container" id="score-modal">
          
            <div class="modal-content-container">
              
                <h1>Congratulations, Quiz Completed.</h1>
              
                <div class="grade-details">
                    <p>Attempts : 2</p>
                    <p>Wrong Answers : <span id="wrong-answers"></span></p>
                    <p>Right Answers : <span id="right-answers"></span></p>
                    <p>Grade : <span id="grade-percentage"></span>%</p>
                    <p><span id="remarks"></span></p>
    /*I want to add the HTML code to the remarks section of the grade-details*/ 

                 
                </div>
              
                <div class="modal-button-container">
                    <button onclick="closeScoreModal()">Continue</button>
                </div>
              
            </div>
        </div>

        <div class="game-quiz-container">
          
            <div class="game-details-container">
                <h1>Score : <span id="player-score"></span> / 2</h1>
                <h1> Question : <span id="question-number"></span> / 2</h1>
            </div>

            <div class="game-question-container">
                <h1 id="display-question"></h1>
            </div>

            <div class="game-options-container">
              
               <div class="modal-container" id="option-modal">
                 
                    <div class="modal-content-container">
                         <h1>Please Pick An Option</h1>
                      
                         <div class="modal-button-container">
                            <button onclick="closeOptionModal()">Continue</button>
                        </div>
                      
                    </div>
                 
               </div>
              
                <span>
                    <input type="radio" id="option-one" name="option" class="radio" value="optionA" />
                    <label for="option-one" class="option" id="option-one-label"></label>
                </span>
              

                <span>
                    <input type="radio" id="option-two" name="option" class="radio" value="optionB" />
                    <label for="option-two" class="option" id="option-two-label"></label>
                </span>
              

                <span>
                    <input type="radio" id="option-three" name="option" class="radio" value="optionC" />
                    <label for="option-three" class="option" id="option-three-label"></label>
                </span>
              

                <span>
                    <input type="radio" id="option-four" name="option" class="radio" value="optionD" />
                    <label for="option-four" class="option" id="option-four-label"></label>
                </span>


            </div>

            <div class="next-button-container">
                <button onclick="handleNextQuestion()">Next Question</button>
            </div>

        </div>
    </main>
    <script src="Quiz.js"></script>
</body>
  </body>

</html>

CSS:

/*NARU QUIZ*/


*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, quiz-body{
    height: 100%;
}


quiz-body{
    font-family: 'Arial', sans-serif;

}

quiz-main{
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.game-quiz-container{
    width: 550px;
    height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    border-width: 1px;
    border-style: solid;
}

.game-details-container{
    width: 80%;
    height: 4rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.game-details-container h1{
    font-size: 1.2rem;
}

.game-question-container{
    width: 80%;
    height: 8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid;
}

.game-question-container h1{
    font-size: 1.1rem;
    text-align: center;
    padding: 3px;
}

.game-options-container{
    width: 80%;
    height: 12rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-around;
    font-size:0.96rem;
    text-align: center;
}

.game-options-container span{
    width: 13rem;
    height: 3rem;
    border: 1px solid;
    background-color: #ffffff;
    overflow: hidden;
}
span label{
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s;
    font-weight: 600;
    color: black;
}

input[type="radio"] {
    position: relative;
    display: none;
}


input[type=radio]:checked ~ .option {
}

.next-button-container{
    width: 50%;
    height: 3rem;
    display: flex;
    justify-content: center;
}
.next-button-container button{
    width: 8rem;
    height: 2rem;
    background: none;
    color: black;
    border: 1px solid;
    cursor: pointer;
    outline: none;
}
.next-button-container button:hover{
}

.modal-container{
    display: none;
    position: fixed;
    z-index: 1; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgb(0,0,0); 
    background-color: rgba(0,0,0,0.4); 
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    -webkit-animation: fadeIn 1.2s ease-in-out;
    animation: fadeIn 1.2s ease-in-out;
}

.modal-content-container{
    height: fit-content;
    width: 25rem;
    background-color: #6c5e7c;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    border-style: solid;
    border-width: 1px;
    border-color: #382d44;
    padding: 10px;
}

.modal-content-container h1{
    font-size: 1.3rem;
    height: 3rem;
    color: ;
    text-align: center;
}

.grade-details{
    width: 15rem;
    height: 10rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
}

.grade-details p{
    color: white;
    text-align: center;
}

.modal-button-container{
    height: 2rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-button-container button{
    width: 10rem;
    height: 2rem;
    background: none;
    outline: none;
    border: 1px solid;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
}
.modal-button-container button:hover{
}

@media(min-width : 300px) and (max-width : 350px){
    .game-quiz-container{
        width: 90%;
        height: 80vh;
     }
     .game-details-container h1{
        font-size: 0.8rem;
     }

     .game-question-container{
        height: 6rem;
     }
     .game-question-container h1{
       font-size: 0.9rem;
    }

    .game-options-container span{
        width: 90%;
        height: 2.5rem;
    }
    .game-options-container span label{
        font-size: 0.8rem;
    }
    .modal-content-container{
        width: 90%;
        height: 25rem;
    }

    .modal-content-container h1{
        font-size: 1.2rem;
    }
}

@media(min-width : 350px) and (max-width : 700px){
   .game-quiz-container{
       width: 90%;
       height: 80vh;
    }
    .game-details-container h1{
        font-size: 1rem;
    }

    .game-question-container{
        height: 8rem;
    }

    .game-question-container h1{
        font-size: 0.9rem;
     }

    .game-options-container span{
        width: 90%;
    }
    .modal-content-container{
        width: 90%;
        height: 25rem;
    }
    .modal-content-container h1{
        font-size: 1.2rem;
    }
}



@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity:1 ;}
  }

  @-webkit-keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
  }

JS:

//this would be the object shape for storing the questions  
 //you can change the questions to your own taste or even add more questions..
const questions = [
    {
        question: "What is Naru's pet cat named?",
        optionA: "Nyanko",
        optionB: "Maru",
        optionC: "Koneko",
        optionD: "Nyanchi",
        correctOption: "optionA"
    },

    {
        question: "What is Naru's Blood type?",
        optionA: "AB",
        optionB: "O",
        optionC: "B",
        optionD: "A",
        correctOption: "optionC"
    },

]


let shuffledQuestions = [] //empty array to hold shuffled selected questions

function handleQuestions() { 
    //function to shuffle and push 10 questions to shuffledQuestions array
    while (shuffledQuestions.length <= 1) { //update this to lenth of questions you want -1 i.e if you want 16 questions then <= 15
        const random = questions[Math.floor(Math.random() * questions.length)]
        if (!shuffledQuestions.includes(random)) {
            shuffledQuestions.push(random)
        }
    }
}


let questionNumber = 1
let playerScore = 0  
let wrongAttempt = 0 
let indexNumber = 0

// function for displaying next question in the array to dom
function NextQuestion(index) {
    handleQuestions()
    const currentQuestion = shuffledQuestions[index]
    document.getElementById("question-number").innerHTML = questionNumber
    document.getElementById("player-score").innerHTML = playerScore
    document.getElementById("display-question").innerHTML = currentQuestion.question;
    document.getElementById("option-one-label").innerHTML = currentQuestion.optionA;
    document.getElementById("option-two-label").innerHTML = currentQuestion.optionB;
    document.getElementById("option-three-label").innerHTML = currentQuestion.optionC;
    document.getElementById("option-four-label").innerHTML = currentQuestion.optionD;

}


function checkForAnswer() {
    const currentQuestion = shuffledQuestions[indexNumber] //gets current Question 
    const currentQuestionAnswer = currentQuestion.correctOption //gets current Question's answer
    const options = document.getElementsByName("option"); //gets all elements in dom with name of 'option' (in this the radio inputs)
    let correctOption = null

    options.forEach((option) => {
        if (option.value === currentQuestionAnswer) {
            //get's correct's radio input with correct answer
            correctOption = option.labels[0].id
        }
    })
   
    //checking to make sure a radio input has been checked or an option being chosen
    if (options[0].checked === false && options[1].checked === false && options[2].checked === false && options[3].checked == false) {
        document.getElementById('option-modal').style.display = "flex"
    }

    //checking if checked radio button is same as answer
    options.forEach((option) => {
        if (option.checked === true && option.value === currentQuestionAnswer) {
            document.getElementById(correctOption).style.backgroundColor = "rgb(189, 228, 173)"
            playerScore++
            indexNumber++
            //set to delay question number till when next question loads
            setTimeout(() => {
                questionNumber++
            }, 1000)
        }

        else if (option.checked && option.value !== currentQuestionAnswer) {
            const wrongLabelId = option.labels[0].id
            document.getElementById(wrongLabelId).style.backgroundColor = "rgb(247, 150, 150)"
            document.getElementById(correctOption).style.backgroundColor = "rgb(189, 228, 173)"
            wrongAttempt++
            indexNumber++
            //set to delay question number till when next question loads
            setTimeout(() => {
                questionNumber++
            }, 1000)
        }
    })
}



//called when the next button is called
function handleNextQuestion() {
    checkForAnswer()
    unCheckRadioButtons()
    //delays next question displaying for a second
    setTimeout(() => {
        if (indexNumber <= 1) { //update this to number of questions you want -1. determines when there's no more question and should display answer
            NextQuestion(indexNumber)
        }
        else {
            handleEndGame()
        }
        resetOptionBackground()
    }, 1000);
}

//sets options background back to null after display the right/wrong colors
function resetOptionBackground() {
    const options = document.getElementsByName("option");
    options.forEach((option) => {
        document.getElementById(option.labels[0].id).style.backgroundColor = ""
    })
}

// unchecking all radio buttons for next question(can be done with map or foreach loop also)
function unCheckRadioButtons() {
    const options = document.getElementsByName("option");
    for (let i = 0; i < options.length; i++) {
        options[i].checked = false;
    }
}

// function for when all questions being answered
function handleEndGame() {
    let remark = null
    let remarkColor = null

    // condition check for player remark and remark color
    if (playerScore <= 0) {
        remark = "Fail"
        remarkColor = "black"
    }
    else if (playerScore >= 0 && playerScore < 1) {
        remark = "Average Grades, You can do better."
        remarkColor = "black"
    }
    else if (playerScore >= 0 && playerScore < 1) {
        remark = "Excellent, Keep the good work going." 
        remarkColor = "black"
    }
    else if (playerScore = 2) {
        remark = "100% Amazing!" 
        remarkColor = "black"
       //I want to add the HTML to this parameter 
        
    }
  //playerScore divided by new length of questions
    const playerGrade = (playerScore / 2) * 100

    //data to display to score board
    document.getElementById('remarks').innerHTML = remark
    document.getElementById('remarks').style.color = remarkColor
    document.getElementById('grade-percentage').innerHTML = playerGrade
    document.getElementById('wrong-answers').innerHTML = wrongAttempt
    document.getElementById('right-answers').innerHTML = playerScore
    document.getElementById('score-modal').style.display = "flex"

}

//closes score modal and resets game
function closeScoreModal() {
    questionNumber = 1
    playerScore = 0
    wrongAttempt = 0
    indexNumber = 0
    shuffledQuestions = []
    NextQuestion(indexNumber)
    document.getElementById('score-modal').style.display = "none"
}

//function to close warning modal
function closeOptionModal() {
    document.getElementById('option-modal').style.display = "none"
}

For further context I want the html image and text box to display below the “remarks” in this pop-up
Image of Pop-up showing quiz resuts

Desired Effect in image form
Image of Pop-up showing quiz results and image embed

Looking to insert html in results window of a quiz when result of 100% is acheived [closed]

Expected to happen: When getting a 100% result in quiz a “prize” is displayed below the remarks which includes an image and embed code

What actually happened: It either did not work at all or it inserted it for all results and not just when full score is achieved.

I am very very new to programming so I am very out of my depth here, but I feel like this should be possible, however when trying to adjust the code it broke or did nothing at all.

Minimal Reproducible Example on codepen: https://codepen.io/Ariane-the-sasster/pen/qEdMEQN

HTML I want to be displayed in pop-up window (.modal-content-container) when 100% result is achieved

<a href="https://arianami.neocities.org/CatCafe.html"><img src="https://files.catbox.moe/wg0rom.gif"></a>
  <textarea style="width:88px; height:31px; overflow:auto; padding:5px;"><a href="https://arianami.neocities.org"><img src="https://files.catbox.moe/wg0rom.gif"></a></textarea>

HTML

<!DOCTYPE html>
  <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Naru chan's Cat Cafe</title>
      <link rel="stylesheet" href="style.css">
    </head>
    <body>
<body onload="NextQuestion(0)">
    <main>
        <!-- creating a modal for when quiz ends -->
        <div class="modal-container" id="score-modal">
          
            <div class="modal-content-container">
              
                <h1>Congratulations, Quiz Completed.</h1>
              
                <div class="grade-details">
                    <p>Attempts : 12</p>
                    <p>Wrong Answers : <span id="wrong-answers"></span></p>
                    <p>Right Answers : <span id="right-answers"></span></p>
                    <p>Grade : <span id="grade-percentage"></span>%</p>
                    <p><span id="remarks"></span></p>
/*I want to add the HTML code to the remarks section of the grade-details*/                  
                </div>
              
                <div class="modal-button-container">
                    <button onclick="closeScoreModal()">Continue</button>
                </div>
              
            </div>
        </div>

        <div class="game-quiz-container">
          
            <div class="game-details-container">
                <h1>Score : <span id="player-score"></span> / 12</h1>
                <h1> Question : <span id="question-number"></span> / 12</h1>
            </div>

            <div class="game-question-container">
                <h1 id="display-question"></h1>
            </div>

            <div class="game-options-container">
              
               <div class="modal-container" id="option-modal">
                 
                    <div class="modal-content-container">
                         <h1>Please Pick An Option</h1>
                      
                         <div class="modal-button-container">
                            <button onclick="closeOptionModal()">Continue</button>
                        </div>
                      
                    </div>
                 
               </div>
              
                <span>
                    <input type="radio" id="option-one" name="option" class="radio" value="optionA" />
                    <label for="option-one" class="option" id="option-one-label"></label>
                </span>
              

                <span>
                    <input type="radio" id="option-two" name="option" class="radio" value="optionB" />
                    <label for="option-two" class="option" id="option-two-label"></label>
                </span>
              

                <span>
                    <input type="radio" id="option-three" name="option" class="radio" value="optionC" />
                    <label for="option-three" class="option" id="option-three-label"></label>
                </span>
              

                <span>
                    <input type="radio" id="option-four" name="option" class="radio" value="optionD" />
                    <label for="option-four" class="option" id="option-four-label"></label>
                </span>


            </div>

            <div class="next-button-container">
                <button onclick="handleNextQuestion()">Next Question</button>
            </div>

        </div>
    </main>
    <script src="Quiz.js"></script>
</body>
  </body>
</html>

CSS:

/*NARU QUIZ*/


*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, quiz-body{
    height: 100%;
}


quiz-body{
    font-family: 'Arial', sans-serif;

}

quiz-main{
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.game-quiz-container{
    width: 550px;
    height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    border-width: 1px;
    border-style: solid;
}

.game-details-container{
    width: 80%;
    height: 4rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.game-details-container h1{
    font-size: 1.2rem;
}

.game-question-container{
    width: 80%;
    height: 8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid;
}

.game-question-container h1{
    font-size: 1.1rem;
    text-align: center;
    padding: 3px;
}

.game-options-container{
    width: 80%;
    height: 12rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-around;
    font-size:0.96rem;
    text-align: center;
}

.game-options-container span{
    width: 13rem;
    height: 3rem;
    border: 1px solid;
    background-color: #ffffff;
    overflow: hidden;
}
span label{
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s;
    font-weight: 600;
    color: black;
}

input[type="radio"] {
    position: relative;
    display: none;
}


input[type=radio]:checked ~ .option {
}

.next-button-container{
    width: 50%;
    height: 3rem;
    display: flex;
    justify-content: center;
}
.next-button-container button{
    width: 8rem;
    height: 2rem;
    background: none;
    color: black;
    border: 1px solid;
    cursor: pointer;
    outline: none;
}
.next-button-container button:hover{
}

.modal-container{
    display: none;
    position: fixed;
    z-index: 1; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgb(0,0,0); 
    background-color: rgba(0,0,0,0.4); 
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    -webkit-animation: fadeIn 1.2s ease-in-out;
    animation: fadeIn 1.2s ease-in-out;
}

.modal-content-container{
    height: fit-content;
    width: 25rem;
    background-color: #6c5e7c;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    border-radius: 25px;
    border-style: dashed;
    border-width: 1px;
    border-color: #382d44;
    padding: 10px;
}

.modal-content-container h1{
    font-size: 1.3rem;
    height: 3rem;
    color: ;
    text-align: center;
}

.grade-details{
    width: 15rem;
    height: 10rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
}

.grade-details p{
    color: white;
    text-align: center;
}

.modal-button-container{
    height: 2rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-button-container button{
    width: 10rem;
    height: 2rem;
    background: none;
    outline: none;
    border: 1px solid;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
}
.modal-button-container button:hover{
}

@media(min-width : 300px) and (max-width : 350px){
    .game-quiz-container{
        width: 90%;
        height: 80vh;
     }
     .game-details-container h1{
        font-size: 0.8rem;
     }

     .game-question-container{
        height: 6rem;
     }
     .game-question-container h1{
       font-size: 0.9rem;
    }

    .game-options-container span{
        width: 90%;
        height: 2.5rem;
    }
    .game-options-container span label{
        font-size: 0.8rem;
    }
    .modal-content-container{
        width: 90%;
        height: 25rem;
    }

    .modal-content-container h1{
        font-size: 1.2rem;
    }
}

@media(min-width : 350px) and (max-width : 700px){
   .game-quiz-container{
       width: 90%;
       height: 80vh;
    }
    .game-details-container h1{
        font-size: 1rem;
    }

    .game-question-container{
        height: 8rem;
    }

    .game-question-container h1{
        font-size: 0.9rem;
     }

    .game-options-container span{
        width: 90%;
    }
    .modal-content-container{
        width: 90%;
        height: 25rem;
    }
    .modal-content-container h1{
        font-size: 1.2rem;
    }
}



@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity:1 ;}
  }

  @-webkit-keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
  }

JS:

[
    {
        question: "What is Naru's pet cat named?",
        optionA: "Nyanko",
        optionB: "Maru",
        optionC: "Koneko",
        optionD: "Nyanchi",
        correctOption: "optionA"
    },

    {
        question: "What is Naru's Blood type?",
        optionA: "AB",
        optionB: "O",
        optionC: "B",
        optionD: "A",
        correctOption: "optionC"
    },

    {
        question: "What is special about Naru's Birthday?",
        optionA: "Doll's Festival",
        optionB: "Cat Day",
        optionC: "Children's Day",
        optionD: "Tanabata",
        correctOption: "optionA"
    },

    {
        question: "Why did Naru initially not like her given name?",
        optionA: "It sounds scary",
        optionB: "She hates thunderstorms",
        optionC: "It sounds too masculine",
        optionD: "It was the name her parents gave her",
        correctOption: "optionD"
    },

    {
        question: "What age did Naru meet Izumi and Makoto?",
        optionA: "7 years old",
        optionB: "6 years old",
        optionC: "4 years old",
        optionD: "5 years old",
        correctOption: "optionC"
    },

    {
        question: "What is Naru's favourite colour?",
        optionA: "Pink",
        optionB: "Yellow",
        optionC: "Lilac",
        optionD: "Red",
        correctOption: "optionB"
    },

    {
        question: "What is Naru's favourite food?",
        optionA: "Oyakodon",
        optionB: "Miso Soup",
        optionC: "Karaage Chicken",
        optionD: "Chicken Katsudon",
        correctOption: "optionC"
    },

    {
        question: "What is an accessory Naru is rarely seen without?",
        optionA: "Rings",
        optionB: "Necklace",
        optionC: "Wristwatch",
        optionD: "Chain Braclet",
        correctOption: "optionA"
    },

    {
        question: "What manga has Naru canonically read and quoted?",
        optionA: "Dragon Ball",
        optionB: "Boys Over Flowers.",
        optionC: "Sailor Moon",
        optionD: "One Piece",
        correctOption: "optionD"
    },

    {
        question: "In her 'Made Mood' card which pose is Naru doing with her hands?",
        optionA: "Pointing",
        optionB: "Finger Heart",
        optionC: "Peace sign",
        optionD: "Heart hand",
        correctOption: "optionD"
    },

    {
        question: "Why was Naru's hair brown in her first year?",
        optionA: "She wanted to blend in more",
        optionB: "She had a rebellious phase",
        optionC: "She dyed it to match her crush",
        optionD: "It's her natural hair colour",
        correctOption: "optionC"
    },

    {
        question: "What is Naru, above all, committed to?",
        optionA: "Self-love",
        optionB: "Caring for her friends",
        optionC: "Modelling",
        optionD: "Romance",
        correctOption: "optionA"
    },


    {
        question: "What has Naru said she adores in a person?",
        optionA: "Tsundere",
        optionB: "Hard-working",
        optionC: "Tall and handsome",
        optionD: "Brunettes",
        correctOption: "optionB"
    },

    {
        question: "Who are Naru's Roommates?",
        optionA: "Mama, Sora and Wataru",
        optionB: "Shu, Kuroo and Mao",
        optionC: "Mika and Hinata",
        optionD: "Himeru and Tetora",
        correctOption: "optionD"
    },

    {
        question: "What is Naru's current goal?",
        optionA: "To have her own brand",
        optionB: "To make a new fragrance line",
        optionC: "To make her screen acting debut",
        optionD: "To move overseas to model",
        correctOption: "optionA"
    },

    {
        question: "How tall is Naru?",
        optionA: "174cm",
        optionB: "171cm",
        optionC: "176cm",
        optionD: "179cm",
        correctOption: "optionC"
    },

    {
        question: "How does Naru refer to most people?",
        optionA: "-chan",
        optionB: "-kyun",
        optionC: "-chin",
        optionD: "-shi",
        correctOption: "optionA"
    },

    {
        question: "What is Naru's Feature Scout card called?",
        optionA: "Elegant Fragrance",
        optionB: "Alluring Fragrant Blossom",
        optionC: "My Best Self",
        optionD: "Dreaming Lady",
        correctOption: "optionC"
    },

    {
        question: "Who is Naru's Best Friend?",
        optionA: "Kanata Shinkai",
        optionB: "Ritsu Sakuma",
        optionC: "Izumi Sena",
        optionD: "Mika Kagehira",
        correctOption: "optionD"
    },

    {
        question: "How many siblings does Naru have?",
        optionA: "One",
        optionB: "Two",
        optionC: "Four",
        optionD: "Three",
        correctOption: "optionA"
    },

    {
        question: "What is Naru's title in knights?",
        optionA: "Duchess",
        optionB: "Princess",
        optionC: "Big sister",
        optionD: "Queen",
        correctOption: "optionD"
    },

    {
        question: "Who reminds Naru of 'That Person'?",
        optionA: "Akiomi Kunugi",
        optionB: "Leo Tsukinaga",
        optionC: "Mika Kagehira",
        optionD: "Mayoi Ayase",
        correctOption: "optionB"
    },

    {
        question: "What is the name of the circle Naru is a part of?",
        optionA: "Magical6",
        optionB: "Pretty5",
        optionC: "Manga Club",
        optionD: "CRAFTMONSTER",
        correctOption: "optionB"
    },

    {
        question: "Who composed Naru's event song 'Heart Collector'?",
        optionA: "Leo Tsukinaga",
        optionB: "Herself",
        optionC: "Ritsu Sakuma",
        optionD: "Izumi Sena",
        correctOption: "optionC"
    },

    {
        question: "How many piercings does she have?",
        optionA: "Three",
        optionB: "Four",
        optionC: "Two",
        optionD: "Six",
        correctOption: "optionA"
    }

]


let shuffledQuestions = [] //empty array to hold shuffled selected questions

function handleQuestions() { 
    //function to shuffle and push 10 questions to shuffledQuestions array
    while (shuffledQuestions.length <= 11) { //update this to lenth of questions you want -1 i.e if you want 16 questions then <= 15
        const random = questions[Math.floor(Math.random() * questions.length)]
        if (!shuffledQuestions.includes(random)) {
            shuffledQuestions.push(random)
        }
    }
}


let questionNumber = 1
let playerScore = 0  
let wrongAttempt = 0 
let indexNumber = 0

// function for displaying next question in the array to dom
function NextQuestion(index) {
    handleQuestions()
    const currentQuestion = shuffledQuestions[index]
    document.getElementById("question-number").innerHTML = questionNumber
    document.getElementById("player-score").innerHTML = playerScore
    document.getElementById("display-question").innerHTML = currentQuestion.question;
    document.getElementById("option-one-label").innerHTML = currentQuestion.optionA;
    document.getElementById("option-two-label").innerHTML = currentQuestion.optionB;
    document.getElementById("option-three-label").innerHTML = currentQuestion.optionC;
    document.getElementById("option-four-label").innerHTML = currentQuestion.optionD;

}


function checkForAnswer() {
    const currentQuestion = shuffledQuestions[indexNumber] //gets current Question 
    const currentQuestionAnswer = currentQuestion.correctOption //gets current Question's answer
    const options = document.getElementsByName("option"); //gets all elements in dom with name of 'option' (in this the radio inputs)
    let correctOption = null

    options.forEach((option) => {
        if (option.value === currentQuestionAnswer) {
            //get's correct's radio input with correct answer
            correctOption = option.labels[0].id
        }
    })
   
    //checking to make sure a radio input has been checked or an option being chosen
    if (options[0].checked === false && options[1].checked === false && options[2].checked === false && options[3].checked == false) {
        document.getElementById('option-modal').style.display = "flex"
    }

    //checking if checked radio button is same as answer
    options.forEach((option) => {
        if (option.checked === true && option.value === currentQuestionAnswer) {
            document.getElementById(correctOption).style.backgroundColor = "rgb(189, 228, 173)"
            playerScore++
            indexNumber++
            //set to delay question number till when next question loads
            setTimeout(() => {
                questionNumber++
            }, 1000)
        }

        else if (option.checked && option.value !== currentQuestionAnswer) {
            const wrongLabelId = option.labels[0].id
            document.getElementById(wrongLabelId).style.backgroundColor = "rgb(247, 150, 150)"
            document.getElementById(correctOption).style.backgroundColor = "rgb(189, 228, 173)"
            wrongAttempt++
            indexNumber++
            //set to delay question number till when next question loads
            setTimeout(() => {
                questionNumber++
            }, 1000)
        }
    })
}



//called when the next button is called
function handleNextQuestion() {
    checkForAnswer()
    unCheckRadioButtons()
    //delays next question displaying for a second
    setTimeout(() => {
        if (indexNumber <= 11) { //update this to number of questions you want -1. determines when there's no more question and should display answer
            NextQuestion(indexNumber)
        }
        else {
            handleEndGame()
        }
        resetOptionBackground()
    }, 1000);
}

//sets options background back to null after display the right/wrong colors
function resetOptionBackground() {
    const options = document.getElementsByName("option");
    options.forEach((option) => {
        document.getElementById(option.labels[0].id).style.backgroundColor = ""
    })
}

// unchecking all radio buttons for next question(can be done with map or foreach loop also)
function unCheckRadioButtons() {
    const options = document.getElementsByName("option");
    for (let i = 0; i < options.length; i++) {
        options[i].checked = false;
    }
}

// function for when all questions being answered
function handleEndGame() {
    let remark = null
    let remarkColor = null

    // condition check for player remark and remark color
    if (playerScore <= 3) {
        remark = "Fail"
        remarkColor = "rgb(163, 42, 52)"
    }
    else if (playerScore >= 4 && playerScore < 7) {
        remark = "Average Grades, You can do better."
        remarkColor = "rgb(255, 187, 174)"
    }
    else if (playerScore >= 7 && playerScore < 12) {
        remark = "Excellent, Keep the good work going." 
        remarkColor = "rgb(179, 235, 195)"
    }
    else if (playerScore = 12) {
        remark = "100% Amazing!" 
        remarkColor = "rgb(196, 139, 230)"
        
    }
  //playerScore divided by new length of questions
    const playerGrade = (playerScore / 12) * 100

    //data to display to score board
    document.getElementById('remarks').innerHTML = remark
    document.getElementById('remarks').style.color = remarkColor
    document.getElementById('grade-percentage').innerHTML = playerGrade
    document.getElementById('wrong-answers').innerHTML = wrongAttempt
    document.getElementById('right-answers').innerHTML = playerScore
    document.getElementById('score-modal').style.display = "flex"

}

//closes score modal and resets game
function closeScoreModal() {
    questionNumber = 1
    playerScore = 0
    wrongAttempt = 0
    indexNumber = 0
    shuffledQuestions = []
    NextQuestion(indexNumber)
    document.getElementById('score-modal').style.display = "none"
}

//function to close warning modal
function closeOptionModal() {
    document.getElementById('option-modal').style.display = "none"
}

For further context I want the html image and text box to display below the “remarks” in this pop-up
[Image of Pop-up showing quiz resuts][1]
[1]: https://i.sstatic.net/UmbQz9fE.png

Need previous/next arrows within Elementor Tabs Widget to navigate between tabs

Need to make the green left/right arrow buttons open up the prev/next tabs respectively on the Elementor Tabs Widget on this page. https://rsaengineering.wpenginepowered.com/capabilities/

The tab widget has the ID #capabilities-tabs and each tab has a manual ID on it of #tab-1 though #tab-12.

I’ve tried variants of JS snippets like below, but it still doesn’t seem to be working. Can someone please tell me what the issue is?

document.addEventListener('DOMContentLoaded', function () {
  const tabsContainer = document.querySelector('#capabilities-tabs');
  const tabTitles = tabsContainer.querySelectorAll('.elementor-tab-title');
  const nextButton = document.querySelector('.next-tab-button');

  nextButton.addEventListener('click', function () {
    const activeTab = tabsContainer.querySelector('.elementor-tab-title.elementor-active');
    let currentIndex = Array.from(tabTitles).indexOf(activeTab);
    let nextIndex = (currentIndex + 1) % tabTitles.length;

    // Simulate click on the next tab
    tabTitles[nextIndex].click();
  });
});
window.addEventListener('load', function() {
  const hash = window.location.hash.substring(1); // remove the '#'

  if (hash) {
    const targetPanel = document.getElementById(hash);
    if (targetPanel) {
      const targetControl = targetPanel.getAttribute('aria-labelledby');
      if (targetControl) {
        const tabTitle = document.getElementById(targetControl);
        if (tabTitle) {
          tabTitle.click();
        }
      }
    }
  }
});

etc…

Trouble Oath Authentification podio

I am having troubles with the Authentikation Token with Script. I have changes the ID of Podio and the APP 3 times, and it doesn’t work.

❌ Error OAuth: 400 – {“error”:”invalid_client”,”error_detail”:”oauth.client.invalid_id”,”error_description”:”Sorry, you’ve supplied an invalid client id.”,”error_parameters”:{},”error_propagate”:true,”request”:{“url”:”http://api.podio.com/oauth/token”,”method”:”POST”,”query_string”:””}}
Información Token OAuth: ❌

Any idea where is my mistake?

I have tried several times with different scripts. I am trying to configurate a Webhook that helps me, that everytime I issue an Invoice in APP2 the VIPS Customers with specific Workspaces with their invoices, get a copy of this invoice in that workspaces, so I don¡t have to copy it manually.

When to use getReader() versus [Symbol.asyncIterator]()

With the current WebAPI’s there seems to be two very similar ways to consume a ReadableStream and I’m curious what are the pros/cons of each and in which use cases I’d use one over the other. I’ve tried searching and AI prompting to no avail.

Say I have a ReadableStream like this:

class MyStream extends ReadableStream {
    #count = 0;
    constructor() {
        super({
            pull: (controller) => controller.enqueue(this.#count++),
        });
    }
}

There are two ways to consume this stream that we commonly see online:

getReader().read()

const reader = new MyStream().getReader();
let done = false;
let value = 0;

try {
    while (!done && value < 5) {
        ({ done, value } = await reader.read());
        console.log(value);
    }
} finally {
    reader.releaseLock();
}

Or for individual chunks:

const reader = new MyReader().getReader();
try {
    const { value: firstCount } = await reader.read();
} finally {
    reader.releaseLock();
}

for await…of

for await (const count of new MyStream()) {
    console.log(count);
    if (count >= 5) break;
}

Or for individual chunks:

const iter = new MyReader()[Symbol.asyncIterator]();
try {
    const { value: firstCount } = await iter.next();
} finally {
    iter.return();
}

Based on these two I’m curious why we have both and when would we use one over the other?

How can I quickly calculate my final grade if I have multiple assignments with different weightages?

I am trying to calculate my final grade for a course where assignments, quizzes, and exams all have different weightages (for example, quizzes 20%, midterm 30%, final exam 50%).
I want to calculate it accurately without manually doing a lot of math or mistakes. I am looking for a reliable way to compute this easily.

I tried doing the calculation manually using a spreadsheet, but it became confusing because of the different weights and scores.
I also found an online tool https://easygradescalculator.com/ that lets you input your scores and weights. It seems to work, but I want to confirm if this is accurate or if there’s a better method or tool that is commonly recommended by developers or educators.

How can I count items from an output html list

I am trying to count the number of items displayed in the following html table output list. By adding this script at the end and displaying the count number, but nothing displays

const count = document.getElementsByClassName("datacells")
console.log(count);
<tr>
  <td colspan="2">
    <table align="center" border="1" cellpadding="3" cellspacing="0" class="zeroBorder" width="100%">
      <tr class="headers">
        <td width="5%"><strong>Id</strong></td>
        <td width="10%"><strong>Risk title</strong></td>
        <td width="20%"><b>Description</b></td>
        <td width="4%"><strong>Status</strong></td>
      </tr>

      <output_list object="Risk_x">
        <tr>
          <td class="datacells" width="2">
            <ol_field name="Id" />
          </td>
          <td width="3">
            <ol_field name="Risk_Name_x" />
          </td>
          <td width="5">
            <ol_field name="Risk_Description_x" />
          </td>
          <td class="datacells" width="3">
            <ol_field name="Status_x" />
          </td>
        </tr>
      </output_list>
    </table>
  </td>
</tr>

Display default tab on navigating from any other URL

I am working on a page using javascript.

In that page I have taken a bootstrap tab. Created 4 tabs. I have implemented the feature of redirecting to same tab after user refreshing the same page by using localstorage concept.

But the moment I switched to the out of page 2 and revisits the it is showing the localstorage tab instead of the default 1st tab.

  1. Redirected to page 2
  2. Switched to tab 3 (This stores the tab 3 in localstorage)
  3. Redirected to Page 3
  4. Clicked on Page 2 again.
  5. Seeing tab 3 got enabled, instead of default tab 1.

Here I can work only on page 2, I cant modify any other pages like page 4.

Navigate to the default tab 1 after redirecting from other URL

How to Optimize JavaScript for Dynamic Question Rendering in a Flask App? [closed]

I’m working on a Flask-based exam portal where I use JavaScript to dynamically render multiple-choice questions fetched from a backend API. The questions are displayed one at a time with “Next”/“Previous” buttons.
The issue is that rendering feels sluggish when there are many questions (e.g., 50+). I’ve tried using async/await to handle API calls, but the UI still lags. How can I optimize this for better performance? Should I use a library like React, or are there vanilla JavaScript techniques to improve rendering speed? I’ve read about debouncing but am unsure how to apply it here.