jQuery(function($) { function my_check_categories() { $('#my-meta-box').hide(); // intially hides the metabox
jQuery(function($)
{
function my_check_categories()
{
$('#my-meta-box').hide(); // intially hides the metabox
/* script to show metabox on category ids 2,3 and 4 (write the category ids in the if condition below on line 14)*/
$('#event-categorieschecklist input[type="checkbox"]').each(function(i,e)
{
var id = $(this).attr('id').match(/-([0-9]*)$/i);
id = (id && id[1]) ? parseInt(id[1]) : null ;
if ($.inArray(id, [20,6]) > -1 && $(this).is(':checked'))
{
$('#my-meta-box').show();
}
});
}
$('#event-categorieschecklist input[type="checkbox"]').live('click', my_check_categories); // calls the function on click of category checkbox
my_check_categories(); // calls the function on load
});
});