We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

sdd

Thread ID:

Created:

Updated:

Platform:

Replies:

144295 Apr 29,2019 02:22 PM UTC Apr 30,2019 08:45 AM UTC ASP.NET MVC - EJ 2 1
loading
Tags: Textbox
Vanderlei
Asked On April 29, 2019 02:22 PM UTC

Hi guys,

Using EJ2, MVC5, VS2017

Is there a way to have a toggle button to show/hide input password in TextBox component?

 @Html.EJS().TextBox("Password").Placeholder("Senha").FloatLabelType(FloatLabelType.Auto).Type("Password").Render()


Thank you

Prince Oliver [Syncfusion]
Replied On April 30, 2019 08:45 AM UTC

Hello Vanderlei, 

Greetings from Syncfusion support. 

Yes, you can use the button to show and hide the input password in TextBox component. You need to use the type property in textbox and set its value respect to the toggle button’s content. Kindly refer to the following code snippet. 

@Html.EJS().TextBox("Password").Placeholder("Senha").FloatLabelType(FloatLabelType.Auto).Type("Password").Render() 
        <button id="Reveal">Show</button> 
 
<script> 
    document.getElementById('Reveal').onclick = function () { 
        var textObj = document.getElementById("Password").ej2_instances[0]; 
        var togglebtn = document.getElementById("Reveal"); 
        if (textObj.type == 'Password') { 
            textObj.type = "Text"; 
            togglebtn.textContent = 'Hide'; 
        } else { 
            textObj.type = "Password"; 
            togglebtn.textContent = 'Show'; 
        } 
    }; 
</script> 
  
Let us know if you need any further assistance on this. 

Regards, 
Prince 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon