forms - jQuery validation custom error message display for radio button -
error message for a pair of radio buttons to show before the first button I am trying to get
Here is the verification:
Error placement: function (error, element) {if (element.attr ("type") == "radio") error. InsertBefore (element.first ()); Else error.insertAfter (element); } Here is the html:
& lt; Div class = "full" & gt; & Lt; Label id = "sample" & gt; Did you get your sample pack? & Lt; / Label & gt; & Lt; Input type = "radio" name = "sample" id = "sample_yes" value = "yes" /> & Lt; Label = "eliteflexsample_yes" for & gt; Yes & lt; / Label & gt; & Lt; Input type = "radio" name = "sample" id = "sample_no" value = "no" /> & Lt; Label = "eliteflexsample_no" & gt; No & lt; / Label & gt; & Lt; / Div & gt; The error just appears right after the radio button right now.
This is working:
$ (document) Validate ({// your validation option, error placement: function (error, element) {if (element.attr ("type") == "radio") { Error.insertBefore (element);} else {error.insertAfter (element)}}}})}}; One ????
Comments
Post a Comment