Update function to run on $ element