Code

Ticket #10573: 10573_r12827.diff

File 10573_r12827.diff, 728 bytes (added by copelco, 4 years ago)

update using jquery

Line 
1Index: django/contrib/admin/templates/admin/change_form.html
2===================================================================
3--- django/contrib/admin/templates/admin/change_form.html       (revision 12827)
4+++ django/contrib/admin/templates/admin/change_form.html       (working copy)
5@@ -56,7 +56,13 @@
6 {% submit_row %}
7 
8 {% if adminform and add %}
9-   <script type="text/javascript">document.getElementById("{{ adminform.first_field.auto_id }}").focus();</script>
10+    <script type="text/javascript">
11+    (function($) {
12+        $(document).ready(function($) {
13+            $("input:visible:enabled:first").focus();
14+        });
15+    })(jQuery.noConflict());
16+    </script>
17 {% endif %}
18 
19 {# JavaScript for prepopulated fields #}