How to attach click to header child without reusing the code?
Without knowing what your elements are or the html around them, i would say just combine the id's into one selector and use $(this).find in the click function. Example:

$("#id1, #id2, #id3").find(':header').click(function(){
 $(this).find('p').slideToggle('slow')l
});