i am writing jquery validation code and i want to add a div just before the label with a class name. i was unable to do so. So i found to add a wrapper in that label and also found to add class on that wrapper here [second answer] but it too didnt worked out. the page just redirects.
According to that answer i did like this:
$('#frm_product_info').validate({
wrapper: "div class='abc'",
rules:{
lens_type:{
required:true
},
color:{
required:true
}
},
messages:{
lens_type:{
required:"Please select a lens type."
},
color:{
required:"Please select a frame color."
}
}
});
so please can any one help me to add a div before that label..or figure it out why the above code is not working if it is correct.
More codes
HTML
<form name="frm_product_info" id="frm_product_info" method="post" action="http://192.168.1.3/optic/site/cart_steps/steps/">
<h3 class="margin_bottom">Select Lens Type</h3>
<input type="radio" name="lens_type" value="4"/> Progressive<br/>
<input type="radio" name="lens_type" value="3"/> Bifocal<br/>
<input type="radio" name="lens_type" value="2"/> Single Vision Distant<br/>
<input type="radio" name="lens_type" value="1"/> Single Vision Reading<br/>
<input type="submit" value="Buy Now" class=" btn btn_buy_now"/>
</form>
SCRIPT
<script type="text/javascript" src="http://192.168.1.3/optic/js/jquery.validate.js"></script>
<script>
$(document).ready(function(){
$('#frm_product_info').validate({
wrapper: "div",
rules:{
lens_type:{
required:true
},
color:{
required:true
}
},
messages:{
lens_type:{
required:"Please select a lens type."
},
color:{
required:"Please select a frame color."
}
}
});
});
</script>