Dynamic Event Binding
User const $searchIcon = $(".search-icon-event"); const $searchBox = $(".search-box"); $searchIcon.on("click", function () { $searchBox.toggleClass("active"); }); apply on document Assistant To ensure that the event works even if elements are added dynamically to the DOM, use `$(document).on("click", …)` instead of directly binding the event to `$searchIcon`. Here's how you can apply it: ### Updated Code: $(document).on("click", […]