Empty fields after submit

heres my code my i cant get it to empty after submit. can you please help

HTML (I change the button type to submit)

<div data-role="page" id="maths">
    <div data-role="header">
    
    <div data-role="main" class="ui-content">

<label>3 + 4 =</label>
            <input type="text" id="a21">
            <input type="submit" class="button" value="Submit" onclick="w001()">
            <span id="answera21"></span>

        </div>

JS code:

function w001() {
                    var a = document.getElementById("a21").value;
                    var span= document.getElementById('answera21');
                    a=a.toString();
 
                    if (a == "a 7" || a == "7") {
                       
                       span.innerHTML ='correct';
                    } else {
                       span.innerHTML ='incorrect';
                    }
                }

hi can you delete your code i am using it iI am struggling to get empty space below each question. can you help

I didn’t understand what you want.You want to delete my answer?

yes please

@zkauser: the point of a public forum thread is to allow other people, and not just you, to benefit from the discussion.

Asking for the code to be deleted defeats this purpose and is contrary to the spirit of the forums.

1 Like

@zkauser, you mentioned that you are using the code in your assignment. Is this a course assignment that you are supposed to be doing on your own, without anybody’s help?

1 Like

I agree with Technobar and Web machine and my code is not going to delete.I spend my time to find a solution and it belongs to public.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.