html reset all inputs by it’s div or dom parent


sometime we need to reset part of form but not all of form inputs, here is the solution using jquery, we can use dom parent’s name to reset it’s input children :

 

function resetGrading{{$x}}() {
$(‘div#gradeRow{{$x}}’).children().find(‘input, textarea’).each(function(){
$(this).val(”);
});
}

tags : reset html inputs by parent id, set input empty by parent id.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s