Title: Please, avoid jQuery
Last modified: October 15, 2023

---

# Please, avoid jQuery

 *  [cvladan](https://wordpress.org/support/users/cvladan/)
 * (@cvladan)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/please-avoid-jquery/)
 * Please refrain from assuming that jQuery is in use, especially when there isn’t
   much reason for it. For instance, the JS in the file “includes/class-ctn-load-
   time.php” on line 80, instead of the code:
 *     ```wp-block-code
       //ctn loadtime display
       (function($) {
           $(document).on('ready', function () {
               $('.ctn_load_time_in_sec').text(<?php echo $this->load_time; ?> + " seconds");
           });
       })(jQuery)
       ```
   
 * It’s better to use vanilla js, which is also more elegant:
 *     ```wp-block-code
       //ctn loadtime display
       document.addEventListener('DOMContentLoaded', () => {
           let o = document.querySelector('.ctn_load_time_in_sec');
           o && (o.textContent = <?= $this->load_time ?? 'unknown' ?> seconds);
       });
       ```
   
 * In any case, thank you for the plugin.

Viewing 1 replies (of 1 total)

 *  Thread Starter [cvladan](https://wordpress.org/support/users/cvladan/)
 * (@cvladan)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/please-avoid-jquery/#post-17125242)
 * Also, in the nearby PHP code, within the same file, shouldn’t it be “endtime 
   minus starttime” rather than the opposite? Specifically,
 *     ```wp-block-code
       $load_time = $this->starttime - $this->endtime;
       ```
   
 * Shouldn’t it be changed to:
 *     ```wp-block-code
       $load_time = $this->endtime - $this->starttime;
       ```
   
 * Right?

Viewing 1 replies (of 1 total)

The topic ‘Please, avoid jQuery’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/current-template-name_292928.svg)
 * [Duplicate Page, Hide Title, Custom CSS & JS, Exclude Search, Template Info - SmartCare](https://wordpress.org/plugins/current-template-name/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/current-template-name/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/current-template-name/)
 * [Active Topics](https://wordpress.org/support/plugin/current-template-name/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/current-template-name/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/current-template-name/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [cvladan](https://wordpress.org/support/users/cvladan/)
 * Last activity: [2 years, 7 months ago](https://wordpress.org/support/topic/please-avoid-jquery/#post-17125242)
 * Status: not resolved