Get an Insulation quote

[nerdy-form:11859]

 

<script>
document.addEventListener('DOMContentLoaded', function () {
  const subject = 'Get a quote'; // Change per page

  const maxAttempts = 30;
  let attempts = 0;

  const interval = setInterval(function () {
    attempts++;
    const select = document.querySelector('.nf-custom-select');
    if (select) {
      clearInterval(interval);
      if (select.tagName === 'SELECT') {
        const option = Array.from(select.options).find(function (opt) {
          return opt.textContent.trim().toLowerCase() === subject.toLowerCase();
        });
        if (option) {
          select.value = option.value;
          select.dispatchEvent(new Event('change', { bubbles: true }));
          select.dispatchEvent(new Event('input', { bubbles: true }));
        }
      } else {
        select.click();
        setTimeout(function () {
          const items = select.querySelectorAll('li, [role="option"], .nf-custom-select-option');
          const match = Array.from(items).find(function (el) {
            return el.textContent.trim().toLowerCase() === subject.toLowerCase();
          });
          if (match) match.click();
          else select.click();
        }, 150);
      }
    }
    if (attempts >= maxAttempts) clearInterval(interval);
  }, 200);
});
</script>