Possible Scoping Issue

[EDIT]:

  1. I have fixed the error in the code where I was referring to the method of preventDefault and not calling the function. And I have updated the code below.
  2. I have just noticed that the first problem actually is not producing the expected result, as I originally thought (despite what I described in the OP)

I can not seem to figure out how to covercome this issue yet, and I think it is due to scoping.

I am creating a web app to practice math problems (https://family-smith.com/math-practice/)

Currently working on the basic multiplication.

The user inputs their lowest and highest factor that they want to practice and then JS creates random math problems accordingly.

The first math problem seems to be working well. But when a new problem is being asked for, it goes outside of the specified minimum factor.

Example: min = 5 & max = 12. Outout might be somehting like 7 x 8 =
hit "new problem" btn and output might be something like 0 x 5 =

Like I said, I think it is scoping here, but I can't figure out how to overcome this issue:
`

// Add your JS Code here, don't include the <script> tags
// variables for multiple math types


// Muliplication
const multiProbEl = document.getElementById("multi-prob-el")
const btnMultiply = document.getElementById("btn-multiply")
const multiForm = document.getElementById("ws-form-1")
let multiTotalProblems = document.getElementById("wsf-1-field-111")
let multiMin = document.getElementById("wsf-1-field-112")
let multiMax = document.getElementById("wsf-1-field-113")
let multiNum1 = 0
let multiNum2 = 0

multiForm.addEventListener("submit", function(event) {
    event.preventDefault()
    multiMin = document.getElementById("wsf-1-field-112").value
    multiMax = document.getElementById("wsf-1-field-113").value
    newFactors()
    console.log("submit")
    console.log(`multiMin = ${multiMin}`)
    console.log(`multiMax = ${multiMax}`)
})


function newFactors() {
    multiNum1 = Math.floor(Math.random() * (multiMax - 1) + multiMin)
    multiNum2 = Math.floor(Math.random() * (multiMax - 1) + multiMin)
    multiProbEl.textContent = `${multiNum1} * ${multiNum2} = `    
}



btnMultiply.addEventListener("click", function() {
    newFactors()
})

`