I would like an image to be displayed based on what is entered inside the form. The problem is with figure_id as when displayed with console log it is a blank string even when text is submitted inside the form.
<form method="GET" id="figure_choice_form">
<label for="figure_id">Enter ID</label>
<input type="text" id="figure_id" name="figure_id">
</form>
<img id="figure_image" src="RESULT_FROM_THE_FUNCTION" alt="img">
JavaScript I have tried
<script>
function set_image_path(){
var figure_id = document.getElementById("figure_id").value
var image_path = `main/Bricklink/images/${figure_id}.png`
document.getElementById("figure_image").img.src = image_path
}
set_image_path()
</script>
.img.**scr**is incorrect, change it to.img.src