how do I .on('elementCreation')?
Lets say I have this
<label id="cloneme" class="baa"><input type="checkbox"></label>
<div id="foo"></div>
and this
$('#foo').on('??creation??', '.baa', function(){
if ($(this).find(':checkbox').is(':checked')) $(this).addClass('ischecked');
});
Then I do this
// some iterations where
ischecked may or may not be true
$('#cloneme').clone().attr('id','').appendTo('#foo').find(':checkbox').prop('checked',
ischecked);
I can't wait until they're clicked, the class should be ischecked if the checkbox inside is checked. I don't want to add the class while in that cloning loop and I don't want to execute the script inline after creating those elements because there many be checkbox creations elsewhere and I don't like copy&pasted chunks of code. Can I do this with on()?