JQuery script from #4517 for menus/views/item/tmpl/edit.php