[FIXUP] Adjusted javascript for dynamic-fields

Adjusted javascript for dynamic-fields because of the refactored html structure from preveoius commit.