I\'m making a form that I\'m using the amazing JQuery validation plugin for (http://docs.jquery.com/Plugins/Validation/).
This form allows people to make donations
The validation plugin allows for this, for a required attribute you aren't restricted to true/false, you can do this in your rules:
CCNumber:{
required: "#<%=CreditCard.ClientID %>:visible",
creditcard: "#<%=CreditCard.ClientID %>:visible"
}
Also, you can shorten your other syntax in the onload if you aren't restricted for some reason:
$(function() {
$("#<%=Cheque.ClientID %>").hide();
$("#<%=CreditCard.ClientID %>").hide();
});
However, I'd suggest applying a "hidden" css style to them to avoid any possible flicker, then just using the $("#<%=Cheque.ClientID %>").show();
syntax to show them when whatever you do triggers it. Whatever method you go with, then :visible selector will work, it acts exactly like it sounds.