Balmus
Balmus

Reputation: 11

Reset the form after element?

There is such a HTML code:

<div class="addMore"></div>
<div class="adProfInner">
   <div class="formAdd"><form></form></div>
</div>

By clicking on the addMore need to reset the form to the container formAdd

Here is that code did not work:

$(this).next('.adProfInner').find('form').trigger('reset');

Upvotes: 0

Views: 60

Answers (2)

Muhammed Shuhaib
Muhammed Shuhaib

Reputation: 314

You can also use this method.

$('.addMore').click(function(){
    $(this).next('.adProfInner').find('form').reset();
});

or

<div class="addMore"></div>
<div class="adProfInner">
   <div class="formAdd"><form id='my_form'></form></div>
</div>

script here

 $('.addMore').click(function(){
        $('#my_form').reset();
    });

Upvotes: 0

MH2K9
MH2K9

Reputation: 12039

Can try using reset(). Example:

$('.addMore').click(function(){
    $(this).next('.adProfInner').find('form')[0].reset();
});

Upvotes: 2

Related Questions