tags:

views:

33

answers:

2

I would like to reset the values of one set of form fields which belongs to the same class. for example,

<input type="checkbox" name"abc" id="abc" class="class1">
<input type="text" name"abc1" id="abc1" class="class1">
<input type="checkbox" name"abc2" id="abc2" class="class1">

onclick of another checkbox, I would like to reset the above 3 fields. Please help.

A: 

I'd do this on document ready :

jQuery("#abc").bind("click", function(this){
  jQuery( "." + jQuery(this).attr("class") ).val("");
});
marcgg
+2  A: 
$('#somecheckbox').click(function() { 
    $('input.class1').attr('checked', false);
});
Aron Rotteveel
This didnt work for me for some reason.
Aanu
I edited my code; there's a pretty good chance this should work.
Aron Rotteveel