TypeError: $w(...).onReady is not a function

Hello! So, I’ve been following the Corvid tutorial for creating a “show more” button, and I’ve run into an error with the onReady function.

Here is a link to the tutorial I am using:

I made it to the end of part 2 in this tutorial, but it’s telling me that “onReady does not exist on #page1”, and neither does getCurrentItem.

Here is the code I have so far:

Here are the notifications for the errors:

The last step I made before I ran into this error was:
(substitute) #dynamicDataset: the ID of the dataset on your page (hover over it)

The ID I used as a substitute was #page1 and I’m sure this is the issue, but I’m not sure what the ID of my page would actually be. It doesn’t give me the ID when I hover over the page.

I got the #page1 value from a drop-down menu, pictured below:

Any help is appreciated, thank you!

First of all, in line 4 you wrote nReady instead of $w.onReady
Second of all, your dataset property Id is probably not “page1” and that’s why you get errors in lines 5, 9

Oh, sorry, the screenshots I sent were scrolled to the right a little (to show all of line 15), so line 4 wasn’t showing all the way. Here’s the full line 4:

Is there another way to get my dataset ID other than hovering over it?

Click it and see in the property panel. If it’s the only dataset on your page and you haven’t changed its id, then it probably $w(“#dataset1”)

1 Like

Thank you so much for your help!

This is my ID for the page itself, but I’m realizing now that the tutorial is asking me for something I don’t believe is on this page yet. I did a little digging around and saw someone mentioning in a forum that dataset elements are not added to a page by default. I didn’t see adding datasets mentioned in the tutorial I was using, but then again, this is the first time I’ve used Corvid so I’m not very well-versed yet at all.

Could this be my issue?

Yes, each type of element has its own set of properties. The onReady property exists on datasets, but not on pages.

1 Like

Okay, thank you!
So, to make onReady valid for the “show more” button to work, I’d have to add a dataset to the page? How should I go about doing that?

@shareonsong https://support.wix.com/en/article/adding-and-setting-up-a-dataset