Attach event handler after DOM ready