This code was running and now it's not...

@russian-dima

import wixData from "wix-data";


$w.onReady(async() => {
});
// Runs a query on the "sports" collection
wixData.query("HS_Sports_Schedule") 
 // Query the collection for any items whose "sports" field contains  
 // the value the user selected in the dropdown
  .contains("sports", $w("#HSSchedule").value)      //<----Line 10//
  .find()  // Run the query
  .then(res => {console.log(res.items)
 // Set the table data to be the results of the query
     $w("#repeater2").data = res.items 
   });


Error says:
Error: The element selector function (usually $w) cannot be used before the page is ready - Line 10

I don’t have a table. Just a repeater. Editor X version.