elclanrs / jq-idealforms-old

The ultimate framework for building and validating responsive HTML5 forms.
665 stars 95 forks source link

Dynamic check checkbox #94

Closed cartouche699 closed 11 years ago

cartouche699 commented 11 years ago

Hello,

Do you know how is it possible to check s checkbox with jquery?

I tried a lot of things : attr("checked", "checked");

But it add tje attribute to the input not to the span.

Can you help me?

elclanrs commented 11 years ago

You have to trigger the actual event for it to work:

$('#checkbox').trigger('click');

If you need to specify if it's checked or not:

$('#checkbox').prop('checked', true).trigger('change');