Input text javascript events and fix template blowout