schema-and-structured-data-for-wp icon indicating copy to clipboard operation
schema-and-structured-data-for-wp copied to clipboard

fix: jQuery undefined

Open larodiel opened this issue 1 year ago • 0 comments

Issue: Currently, the code jQuery('.saswp_star_color .saswp_star').attr('stop-color', saswpStarColor); in schema-and-structured-data-for-wp/modules/rating-box/frontend.php relies on jQuery, which may cause issues if jQuery is loaded at the very bottom of the footer. This can break the page because the code can't find jQuery.

Proposed Solution: To address this issue, we can implement a fallback mechanism using vanilla JavaScript. The updated code will first check if jQuery is defined. If it is, it will use jQuery to set the stop-color attribute. If not, it will use vanilla JavaScript to achieve the same functionality. This ensures compatibility regardless of where jQuery is loaded.

larodiel avatar Mar 06 '24 00:03 larodiel