skip to Main Content

Jquery – Click event for dynamic id from dynamic elements not working

My footer elements are loading with dynamic id's. I used as follows $(document).ready(function () { $("[id^='footer']").click(function (evt) { evt.preventDefault(); if (window && window.siteConsent && window.siteConsent.manageConsent) { window.siteConsent.manageConsent(); } console.log(evt.target.id) }); }); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <a href="level2Link.NavLink" class="f-link managecookieShow" id="footer-nav-ManageCookies one1" aria-label="level2Link_AriaLabel">…

VIEW QUESTION
Back To Top
Search