mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-12 12:39:43 +02:00
Added logic for case when there are NO additional contacts
This commit is contained in:
parent
892c8331b3
commit
9a5b07c79f
1 changed files with 12 additions and 9 deletions
|
@ -649,6 +649,8 @@ function initializeWidgetOnList(list, parentId) {
|
|||
const contacts = document.querySelectorAll('.field-other_contacts .dja-detail-list dl');
|
||||
if (contacts) {
|
||||
contacts.forEach(contact => {
|
||||
// Check if the <dl> element is not empty
|
||||
if (contact.children.length > 0) {
|
||||
const name = contact.querySelector('a#contact_info_name').innerText;
|
||||
const title = contact.querySelector('span#contact_info_title').innerText;
|
||||
const email = contact.querySelector('span#contact_info_email').innerText;
|
||||
|
@ -658,6 +660,7 @@ function initializeWidgetOnList(list, parentId) {
|
|||
const listItem = document.createElement('li');
|
||||
listItem.innerHTML = `<a href="${url}">${name}</a>, ${title}, ${email}, ${phone}`;
|
||||
bulletList.appendChild(listItem);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue