У меня возникла проблема с плагином jQuery Validator & переключателями. У меня есть набор из трех переключателей "lookingfor"
... и я хочу убедиться, что хотя бы один из них отмечен. Хотя независимо от того, что я делаю, я все еще получаю сообщение «Это поле обязательно». Есть идеи?Проблемы с плагином и переключателями jQuery Validator
<html>
<body>
<form action="#" id="signupform" method="post">
<label for="lookingfor" class="error"></label>
<fieldset name="lookingfor">
<input type="radio" name="lookingfor" value="female"/>
<label for="female"><div class="sprite female" ></div></label>
<input type="radio" name="lookingfor" value="male" />
<label for="male"><div class="sprite male"></div></label>
<input type="radio" name="lookingfor" value="other" />
<label for="other"><div class="sprite other"></div></label>
</fieldset>
<input type="submit" id="submit" value="" />
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/jquery.validate.js" type="text/javascript"></script>
<script>
jQuery(document).ready(function() {
jQuery("#signupform").validate({
rules: {
lookingfor:{ required: true }
}
});
});
</script>
</body>
</html>
Спасибо! которые отлично работали – Greg