Password Protected Elements

This is the example page at the moment:

$w . onReady ( function () {
$w . onReady ( function () {

  $w ( '#buttonGO' ). onClick (() => { 
            toggleBox ( $w ( '#boxDavidsProfile1' ),); 
}); 

});

function toggleBox ( boxElement ) {
const isCollapsed = boxElement . collapsed ;
if ( isCollapsed ) {

        boxElement . expand (); 
}  **else**  { 
                
        boxElement . collapse (); 
} 

}
});