Toggle field doesnt want to show hide text field

Hello, Im working on a web form and it needs to show a text field based on a toggle field.

I've used javascript code from the forum but I can't get it to work:

function showHideField() {

    if(fd.field('Toggle1').value == true) {
         fd.field('Phone').hidden = false;
    }
    else {
       fd.field('Phone').hidden = true;
    }

}

fd.spRendered(function() {

// Calling function on form loading
showHideField();

// Calling function when the user switches the toggle
fd.field('Toggle1').$on('change', showHideField);

});

Hi @kidsunplugged,

The fd.spRendered() is only available in SharePoint forms, please use fd.rendered() instead.

If that doesn't help, could you share a screenshot of the form with the browser's console open (F12)?