F. Flores F. Flores - 1 year ago 98
Javascript Question

How to remove and add input type with jQuery

Hello Im trying to create a login, everything its ok but in my password input I want a span that when user click on it show the password and when click again hide the password at the moment I only have the first step (show the password).

Here is the code

Answer Source

You should try with this:

$('#xd').on('mouseup', function () {
    $('#ContraseƱa').attr('type', 'password')

$('#xd').on('mousedown', function () {
    $('#ContraseƱa').attr('type', 'text')

Code here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download