Translation of edit.html.erb into jQuery (doesn't work)