0

I have a form with a reset button and what I want is to reset only some form elements when that button is clicked.

<form name="frmMyForm">
<input type="text" name="txtText" />
<input type="checkbox" name="chkCheckBox" />

<input type="reset" value="reset" />
</form>

Now I want the checkbox to be reset when I click the reset button is clicked and let the textbox retain its value
Is it possible?

3
Contributors
2
Replies
5
Views
9 Years
Discussion Span
Last Post by MidiMagic
0

I don't know if this is the BEST way to do it, but this would work :

<head>
    
        <script language="javascript">
        function fnMyReset() {
            document.frmMyForm.chkCheckBox.checked = false;
        }
        </script>
    
    </head>
    
    <body>
    
        <form name="frmMyForm">
        
            <input type="text" name="txtText" />
            <input type="checkbox" name="chkCheckBox" />
            
            <!-- changed from type="reset" to type="button" -->
            <input type="button" value="reset" onclick="fnMyReset()" />
        
        </form>
    
    </body>
0

Use a regular button with the word RESET on the face. Use it to call a function to put default values in the ones you want to reset. I wrote several of these.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.