I created a JavaScript prime factor calculator that I'm trying to integrate into my website. I want users to be able to input their own number, but whenever the input is submitted, it leads to an infinite loop. After investigation, I found that the issue lies in the code being used as the function's parameter.
Below is the HTML section:
<div class="pf-calculator-instructions-wrapper"><p class="pf-calculator-instructions">
<em>Enter a number in the field below. Output will be displayed above. Maximum 15 digits.</em></p>
</div>
<input id="pf-input" type="number" maxlength="15" class="pf-calculator-input"/>
<button class="submit-button" onclick="findPrimeFactors(document.getElementById('pf-input').value)">Submit</button>
I tested the function with a hardcoded number (10) and it worked without any issues. However, when I changed it to use the user input value (still set to 10), the page froze, creating what seems like an infinite loop. Am I overlooking something here?
Any help would be appreciated!