Checking Radiobutton in jQuery

This check works, but an error message is displayed next to the radio block that moves before the default label for the radio. Is there a way to put the error message to the right instead?

Run the code to see what I mean.

Thanks for the help.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Form Validation Demo</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.validate.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#form1").validate({ rules: { accept: "required",// simple rule, converted to {required:true} }, messages: { accept: "* Required", } }); }); </script> <style type="text/css"> label.error { color: red; } </style> </head> <body> <form id="form1" method="post" action=""> <div> <input type="radio" name="accept" value="accept" /> Accept </div> <input class="submit" type="submit" value="Submit"> </form> </BODY> </html> 
+4
source share
1 answer

You can try the following:

 label.error { color: red; position:absolute; left:75px; } 

Working example: http://jsfiddle.net/jasongennaro/Ja8jr/

+1
source

All Articles