I have the following jQuery code that listens to a checkbox:
$('.vimeo-pro-checkbox').change(function() {
$('.vimeo-pro-panel').slideToggle();
});
Except it only works if I do something like the following:
// create a function
var init_vimeo_pro_checkbox = function() {
$('.vimeo-pro-checkbox').change(function() {
$('.personal-vimeo-pro-panel').slideToggle();
});
}
var ready = function() {
init_vimeo_pro_checkbox();
};
// call the function
$(ready);
So my question is why doesn't my first version just work? I mean it's inside a jquery function block: $().
I was under the impression the first version would just work, that jQuery would pick up my checkbox.