Articles tagged with once

What is once() in Drupal and do you still need it?

Posted on
JavaScript plays a crucial role in modern web development, enhancing the interactivity and user experience of websites and web applications. In the context of Drupal, a powerful and flexible content management system, JavaScript is utilized to create dynamic and responsive interfaces, making websites more engaging and user-friendly.

How to use Drupal once()

Posted on
Drupal implements its own Javascript API. Most of the time, all code should use behaviors that trigger every time something changes on the page - page loaded, ajax request, and so on. On the other hand, it causes issues with code executing more than one time.

How to migrate from jQuery.once()

Posted on
Drupal 10 removed old jQuery.once() plugin and replaced it with separate library in plain JavaScript. Existing scripts need to be updated, but there are some things to look out and they won't work as it might be assumed.