Extended form checkbox ticked?

Permalink 1 user found helpful
Hi All,

I am using the Extended form add-on and wondered if there was a way to make a checkbox ticked by default?

Many Thanks

Steve

 
VPenkov replied on at Permalink Best Answer Reply
VPenkov
Yes, with jQuery.
Place the following code on the page where your checkbox is:
<script>
$(function(){
    $('input#YOURINPUTID').attr('checked', 'checked');
});
</script>
Make sure to replace "YOURINPUTID" with your input's "id" attribute which you can find in your generated html.
glowmedia replied on at Permalink Reply
Moongrab,

works like a charm :)

Thanks

Steve
LaZion replied on at Permalink Reply
For anyone whom needs to do this with the standard C5 Form Block you can use the following code:

<script type="text/javascript">
$(function(){
$('input[name="YOURINPUTNAME"]').attr('checked', 'checked');
});
</script>

As the ID attribute is not used in the checkbox input tag.