If confirmed password is not match with password, how to show error message?

export function txtConfirmedPassword_input ( event ) {

**let**  password1  =  $w ( "#txtPassword" ). value ; 
**let**  password2  =  $w ( "#txtConfirmedPassword" ). value ; 

**if**  ( password1  ===  password2 ) { 
console . log ( "They match!" ); 

$w ( "#btnSubmit" ); 
}  **else**  { 
    $w ( "#text185" ). text  = "Password and Confirmed Password do not match" ; 
    $w ( "#text185" ). show ; 
    $w ( "#btnSubmit" ). disable (); 
    console . log ( "Password and Confirmed Password are not match" ); 
} 
// This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4 
// Add your code for this event here:  

}


The text185 is not found in the preview page.

export function txtConfirmedPassword_input(event) {
$w("#txtConfirmedPassword").onCustomValidation( (value, reject)=>{
    let password1 = $w("#txtPassword").value;
    let password2 = value;

    if (password1 === password2) {
    console.log("They match!");
        

    $w("#btnSubmit");
    } else {
        //$w("#text185").text ="Password and Confirmed Password do not match";
        //$w("#text185").show
        
        console.log("Password and Confirmed Password are not match");
         reject("Password and Confirmed Password are not match");
    }
})

I don’t know why changing the label would not have any effect. The validation would be processed only when the submit button is pressed.

On the line $w ( "#btnSubmit" );

Nothing is done with the element $w ( “#btnSubmit” );

You can uncomment the code that showing the error.

It should be $w(“#text185”).show() in order to run the function to show the element. () is needed.

Thanks for your comments.

However, nothing would be happen
for the code

$w("#text185").text ="Password and Confirmed Password do not match";
$w("#text185").show

I don’t know the code is used to work, however, after I changed the position of the variable, the error message seems stick to the old position.