I want to remove this attribute
class="validate[custom[card]] text-input"
on my input field named “card” when the radio containing the value “CreditCard” is unselected. This is the script for my radio box:
<script>
$(document).ready(function() {
$("input[name$='sel']").click(function() {
var test = $(this).val();
$("div.desc").hide();
$("#sel" + test).show();
});
});
</script>
and the input field
<table><tr><td>
<p> Credit/Debit Card<lable style="margin-right:1px;"></lable><input
type="radio" name="sel" id="sel" value="CreditCard"
class="validate[required] radio-input" /> </p>
<p> Paypal<input type="radio" id="sel" name="sel" value="Paypal" />
</p>
<p> Wire Transfer<input type="radio" id="sel" name="sel"
value="WireTransfer" /> </p>
<!====================================================================================>
</td<td>
<!====================================================================================>
<div id="selCreditCard" class="desc"> <label for="card"><strong>Card
Number<font color=red size=3> *</font></strong></label>
<input name="card" type="text" id="card" value="" style="width:85px;" class="validate[custom[card]] text-input" />
</div>
<!====================================================================================>
<div id="selPaypal" class="desc" style="display:
none;margin-left:20px;margin-top:1px;margin-bottom:1px;"> paypal
</div>
<!====================================================================================>
<div id="selWireTransfer" class="desc" style="display:
none;margin-left:20px;margin-top:0px;margin-bottom:-5px;"> wired
</div>
<!====================================================================================>
</td></tr></table>
and when the user unselects the radio, the attribute will be returned.
It seems that you are using jQuery. You want to remove the class attribute.
In jquery there is the
removeClass()method.So, you would do:
Note: *validate[custom[card]]* is quite a strange name for a class. I suspect it is not a valid name for a class.