Define javascript behavior for DOM elements