retrive value of textbot after loaded from dataset

I have connected #text10 with dataset value and it is loaded as expected. But on load page when I access the element
$w.onReady( function () {
var textgiven = $w(“text10”).text;
// its value is what was set on editor and not whats loaded by dataset.
how can i get the loaded text without user intervantion.
onChange() does not evoked on dataset changing the value.
it seems that the onready is activated before dataset action.

Hi.

You can use the getCurrentItem() function to get the dataset’s current item when the page loads. To learn more, check out our API here .

Regards!

I get #total is not a valid selector in page code editor
import wixData from ‘wix-data’;
$w.onReady( () => {
$w(“#total”).onReady( () => {
let itemObj = $w(“#total”).getCurrentItem();
console.log(itemObj);
$w(“#html1”).postMessage(“test”);
} );
});

Make sure you are using the ID from the property sheet when you have the dataset selected. In this example #dsSpouses is the ID and not Spouses.