How to Hide Elements on Dynamic Page if fieldKey is Empty

Below is a snippet of currently working small piece of code to show button when there is text in the fieldKey column (so, when there is no text, than there is no button):

I have two elements on the page that I want hidden if the fieldKey has no content. The snippet of code above resolves one of those elements to show as you can see in

$w(" #moretext2btn ").show();

How would or where would I add code for another fieldKey (same dataset) and another ID page element?

Both are pulling from the same database which is the #dynamicDataset
The element Default Values is Hidden and Enabled

The other element ID is moretext3btn
The other fieldKey is expandedText3

Hi there,

You need to check if the field value is falsy or not.

$w.onReady(() => {
    $w('#dataset').onReady(() => {
        const item = $w('#dataset').getCurrentItem();
        
        if (!item.fieldId) {
            // Do the following if the field is empty
        }    
    })
})

This also works if the field type is Boolean and the value isn’t true, and if the field type is number and the value is 0 (ZERO).

Hope this helps~!
Ahmad

everything in the code above works without error. I am just asking about adding in an additional fieldKey and an additional element (button) on the page in the line of code inside the box code provided above. Thank you.

Resolved my own problem… too much over thinking happening in one week.