- Issue created by @mornel
- First commit to issue fork.
- Assigned to igor mashevskyi
- Merge request !10Issue #3350919: Uncaught TypeError: $(...).once is not a function with Drupal 10 → (Merged) created by igor mashevskyi
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 12:00am 26 April 2023 - 🇺🇸United States hockey2112
I am also receiving this error, and my popup is not appearing. Any fix for this?
- 🇺🇸United States hockey2112
I applied the changes to the two files mentioned in https://git.drupalcode.org/project/simple_popup_blocks/-/merge_requests/..., but the issue still exists.
- Status changed to Needs work
over 1 year ago 4:53am 26 April 2023 - 🇮🇳India omkar-pd
I applied the patch and it worked for me. Attaching a screenshot for reference.
- Status changed to Needs review
over 1 year ago 6:53am 26 April 2023 - 🇺🇸United States hockey2112
I am using the Bootstrap Barrio theme. I set up the Simple Popup Blocks module according to the documentation, and I downloaded the two modified files from https://git.drupalcode.org/project/simple_popup_blocks/-/merge_requests/... and added them to my install , overwriting the existing files (and cleared cache). Here are the other steps I followed:
- I created a region in my page.html.twig called "pop". I added that new region to my theme's .info file.
- I created a block called "alertblock" and added it to the "pop" region. It has no page or role restrictions.
- I went to /admin/config/media/simple-popup-blocks/add to create the new pop-up. These are the values I used:
- Unique identifier: alert
- Choose the identifier: Drupal blocks
- Blocks list: alertblock
- Choose Layout: center center
- Popup frequency: Visit counts: 0
- Minimized button: checked
- Close button: checked
- Show minimized...: unchecked
- ESC key to close: checked
- Overlay: checked
- Trigger method: Automatic
- Delays: 0
- Trigger width: blank
- Width: 400
- Cookie expiry: 100
- I saved the Popup. It is "Inactive". I edited it, and made it Active and saved it again.
- I visited the home page of my site, and the pop-up does not appear. I look near the bottom, and I see the popup content in the "pop" region. Therefore, I added the recommended CSS code to my CSS file (#block-alertblock { display: none;}).
- I went back to my home page. The popup content in the "pop" region is now hidden, but the popup never appears
- Chrome dev console shows many errors like this:
Uncaught TypeError: $(...).once is not a function (dupal.js?v=10.0.7:64 )
at Object. (simple_popup_blocks.js?v=10.0.7:113:30)
at Function.each (jquery.min.js?v=3.6.3:2:3003)
at Object.attach (simple_popup_blocks.js?v=10.0.7:11:9)
at drupal.js?v=10.0.7:166:24
at Array.forEach ()
at Drupal.attachBehaviors (drupal.js?v=10.0.7:162:34)
at drupal.init.js?v=10.0.7:32:12
at HTMLDocument.listener (drupal.init.js?v=10.0.7:20:7)
I have tried it in an incognito window as well, but it doesn't appear there either.
Any idea what I might be doing wrong, or anything else I can check?
Thanks!
- 🇺🇸United States hockey2112
I may have identified the issue, but I still don't know what the issue was.
I uninstalled the Admin Toolbar module and its submodules "Admin Toolbar Extra Tools" and "Admin Toolbar Links Access Filter". The popup began working.
I then reinstalled that module and its submodules one by one, clearing cache each time, and the popup continued to work!
This doesn't make any sense to me. It seems to me that I have now reverted back to my original configuration in which the popup didn't work. Any idea what could have been changed by uninstalling and then reinstalling those modules?
- 🇮🇳India gunjan.a2@tcs.com
I have applied the changes provided in https://git.drupalcode.org/issue/simple_popup_blocks-3350919/-/tree/3350... but was still getting js error in console when accessing site as anonymous user. Added patch to resolve the same
- 🇮🇳India gunjan.a2@tcs.com
I have verified changes provided in https://git.drupalcode.org/issue/simple_popup_blocks-3350919/-/tree/3350...
The issue is not appearing for admin users but is replicable for anonymous users. Attached the patch for the same - 🇮🇳India agunjan085
I have tried the code changes mentioned in https://git.drupalcode.org/issue/simple_popup_blocks-3350919/-/tree/3350...
The issue is not occuring when logged in as admin & the popup is working fine as expected but its throwing error in console when opening site as anonymous user. Attaching patch for the same - 🇮🇳India agunjan085
Added core jquery library to the libraries.yml to resolve the console js error for anonymous user. Now the popup is working fine for both anonymous as well as admin user
Issue commit : https://git.drupalcode.org/project/simple_popup_blocks/-/merge_requests/... - Status changed to RTBC
over 1 year ago 5:15am 5 June 2023 I tried to apply patch with composer on drupal 10, it keeps saying:
Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2023-04-27/uncaught_typeerror_once_0... → .- 🇮🇳India agunjan085
Hi @Yuezhu Please use the diff from MR https://git.drupalcode.org/project/simple_popup_blocks/-/merge_requests/10 for testing instead of the patch as it was an old patch
- 🇺🇸United States djween
The patch in #25 fixes issue for authenticated user but not for anonymous user for me.
- 🇹🇷Turkey Umit Turkey
Patch #25 worked for me. This module now needs to be updated.
- 🇦🇷Argentina VITO
Patch #25 🐛 Uncaught TypeError: $(...).once is not a function with Drupal 10 RTBC worked for me.
- 🇮🇳India ravi kant Jaipur
The MR patch is applying and errors is disappearing.
But the popup is not working with 'Choose the identifier - Drupal Block' but working with 'Choose the identifier - Custom css id or class'.
I confirm patch #25 works well.
I applied patch #25 on Drupal `10.3.2` / simple_popup_blocks `8.x-3.1` and the issue is gone.
The `Choose the identifier` is `Drupal Block` and the popup is working for admin and anonymous users. The original block is hidden in the theme region and only shows in the popup.- 🇸🇮Slovenia joco_sp
Patch #25 worked for me on 8.x-3.1.
I didn't try the previous solutions, but allonce
error messages are gone and the popup is working again.I am changing the priority to Major, because the bug makes the popup unusable.
- 🇺🇦Ukraine i-trokhanenko Lutsk 🇺🇦
Any chance to get a fix committed? Thanks in advance!
- 🇯🇴Jordan mahmoud barhouma
patch #25 did not work for me, I suggest that we replace once like patch below
- 🇿🇦South Africa abedmatini
when i installed this module https://www.drupal.org/project/jquery_once → , this error Uncaught TypeError: $(...).once is not a function goes away. but the pop up still not showing up, not sure if i'm missing something else in the popup setup
- 🇿🇦South Africa abedmatini
I could make it work with CSS Selector id (*).
For some reasons, even if the Drupal blocks is selected, it is still looking for a selector id.So installing https://www.drupal.org/project/jquery_once → as well as selecting Css id (#) and targeting the block by that id, made the pop up visible for me
-
i-trokhanenko →
committed ae4b2d23 on 8.x-3.x authored by
igor mashevskyi →
Issue #3350919: Uncaught TypeError: $(...).once is not a function with...
-
i-trokhanenko →
committed ae4b2d23 on 8.x-3.x authored by
igor mashevskyi →
- Status changed to Fixed
3 months ago 7:32pm 13 September 2024 - 🇺🇦Ukraine i-trokhanenko Lutsk 🇺🇦
Committed the patch #25 as it works for most of the users.
@abedmatini, @mahmoud barhouma , make sure the issue is not related to your custom theme. If not, feel free to open a new topic. Automatically closed - issue fixed for 2 weeks with no activity.