Help with javascript graph

Hi!

I’m trying to produce a graph of y = mx+5 where m is gathered from user inputted data. I have the axes laid out before the (and won’t copy and paste them here because its fine), but when I run my program and input a number it shows the graph for a mili second and then it disappears. Does anyone know how to fix this?

Here is my code:

    <font face="Baskerville">Input a value for m:</font><br>
    <input type="number" name="m" Id="m"><br>
    <button onclick="sqr();, doSubmit();">Graph Me!</button><br>
    
</form>

<script type="text/javascript">
    
    function sqr()  
    {
        
        var D = document.getElementById('m').value;
        myGraph.drawEquation(function(x) {
                             return (D * x) + 5;
                             }, 'green', 3);
                     
    }

What does doSubmit() do?

oh whoops! That shouldn’t be there, I must not have recopied the code after I deleted it. I was trying out having the submit button run two separate functions, but it didn’t work out for me.

In order to help we need you to be more specific. What library you’re using to draw the graph? What is the actual code? You said you copied wrong code