Angelo Ganaden Jr.
Angelo Ganaden Jr.

Reputation: 180

why does the input type=reset is not working?

Here is the code. When I try to use input type reset, it is not working. I tried to remove it outside the div, still it's not working.

<div class="container-fluid">
    <div class="row">
        <div class="col s4"></div>
        <div class="col s4">
            <form class="form"  action="<?=base_url()?>item/updatedata/<?=$this->uri->segment(3)?>" method="POST">
                <div class="row">
                    <label>ITEM ID</label>
                    <input type="text" readonly="" value="<?=$items->item_id?>" class="validate">
                    <label>ITEM NAME</label>
                    <input type="text" value="<?=$items->item_name?>" name="item_name" class="validate">
                    <label>ITEM DESCRIPTION</label>
                    <input type="text" value="<?=$items->item_desc?>" name="item_desc" class="validate">
                    <label>ITEM PRICE</label>
                    <input type="text" value="<?=$items->item_price?>" name="item_price" class="validate">
                    <div class="col s6">
                        <button class="btn waves-effect waves-light " type="submit" value="SUBMIT">Submit
                            <i class="material-icons right">send</i>
                        </button>
                    </div>
                    <div class="col s6">
                        <input  class="btn waves-effect waves-light red" type="reset" value="Reset">
                    </div>
                </div> 
            </form>
        </div>
        <div class="col s4"></div>
    </div>
</div>

Upvotes: 1

Views: 20638

Answers (4)

developernader
developernader

Reputation: 105

You can use jQuery

    $('input:reset').click(function () {      
        $('input:text').attr('value', '');
    });

Upvotes: -2

Bala
Bala

Reputation: 1

Please use <input type='reset' value='Reset'/> tag with in the form tag

Upvotes: -2

Yogesh
Yogesh

Reputation: 760

The input type reset resets all form values to default values.

Since for all input elements, you have given a value, this acts as the default value for those elements.

When you click Reset button, all the values are set to default values that you have given.

If you remove value attributes, the reset will set all the values to blank (in case of text), and it will work as you expected.

Upvotes: 14

Prashanth kumar
Prashanth kumar

Reputation: 985

As long as your <input type ="reset"> tag is inside the form there shouldn't be any problem. I'ts working fine in the reproduced fiddle.

https://jsfiddle.net/prashu421/3wa9v7p6/

If that isn't working for you, you can use as below

<button  class="btn waves-effect waves-light red" type="reset" value="Reset" > Reset </button>

Upvotes: -1

Related Questions