標題加上下面的例子是很清楚的(至少我希望如此;-))變化對飛類的HTML選擇元素
<label>Girlfriend ? :</label>
<input type="radio" name="girlfriend" value="yes" onclick="add required class to make the choice of an option in the select element girlfriend compulsory">Yes
<input type="radio" name="girlfriend" value="no" checked="checked">No
<select name="girlfriend" id="girlfriend">
<!-- Above I'd like to have class="validate['required']" if the user has chosen the radio button yes-->
<option value="American Girlfriend" selected="selected">American Girlfriend</option>
<option value="German Girlfriend" >German Girlfriend</option>
<option value="French Girlfriend" >French Girlfriend</option>
</select>
是您的類叫做'驗證[ '需要']'?我不確定這是否是有效的CSS。 – pimvdb
你想使用$ .validate插件嗎? – naveen
@pimvdb是的,到目前爲止它的工作。 – Bruno