make jQuery hooks work on replaced elements