Calling a function if checkbox is checked instead of onClick
I need to call this function if a checkbox is checked instead of being triggered by onClick:
- onclick="toggle_colorbox(this);"
How can I insert it into the following function?
- $('.Colorbox').change(function() {
if ($('input:checkbox[name=colors_love[]]:checked')) {
}
});
Function toggle_colorbox(td) changes a boxes opacity and displays a check mark to indicate that a color has been selected, but because I am pre-selecting the values matching a user's account information, I need to initiate the function if that particular checkbox is checked.
If you'd like to see it in context
http://jsfiddle.net/chayanyc/KdcJY/104/