diff --git a/docs/ref/contrib/admin/javascript.txt b/docs/ref/contrib/admin/javascript.txt index ae1e546461..e1188a6f84 100644 --- a/docs/ref/contrib/admin/javascript.txt +++ b/docs/ref/contrib/admin/javascript.txt @@ -68,7 +68,7 @@ to the old listener signature as follows: } $(document).on('formset:added', (event, $row, formsetName) => { - if (event.detail.formsetName) { + if (event.detail && event.detail.formsetName) { // Django >= 4.1 handleFormsetAdded(event.target, event.detail.formsetName) } else {