I have a recaptcha widget in my form and i want it to be made mandatory. since i dont have any direct control over the widget in my html, i was wondering if i can add the required attribute to it after it has been rendered.
ie. if i add the folloing css
#recaptcha_response_field{background-color:#000000;}
it does color up the recaptcha widget text field. in the same vein, if there was some way of setting the required="required" attribute for input fields via css, i'd be able to make it mandatory.
Does the following work for you:
$(function() {
$("#recaptcha_response_field").attr('required','required');
});
$("#recaptcharesponsefield").attr('required','required');
thanks - Rishav Sharan 2012-04-05 19:52
If I understand you correctly, this should do the trick:
$(function() {
$("#recaptcha_response_field").css({background-color:#000000;});
});
Without jQuery:
document.onload = function() {
document.getElementById("recaptcha_response_field").style['background-color'] = '#000000';
};
I'm not 100% sure on the second one, but I can't test it right now.