Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triggering password() from another element does not work the first time #17

Open
hanxue opened this issue Dec 9, 2015 · 2 comments
Open

Comments

@hanxue
Copy link

hanxue commented Dec 9, 2015

bootstrap-show-password version: 1.0.2
jQuery version: 1.8.2

Here's the password element, as well as checkbox to toggle showing password

<p>
  <input type="password" 
    id="admin_pass" 
    name="admin_pass" 
    class="form-control" 
    data-placement="before" />
</p>
<p><label><input id="methods" type="checkbox" /> Show password</label></p>

The corresponding Javascript

 $(function() {
    $('#mysql_sel_1').click();
    $('#admin_pass').password().on('show.bs.password', function(e) {
        $('#methods').prop('checked', true);
    }).on('hide.bs.password', function(e) {
        $('#methods').prop('checked', false);
    });
    $('#methods').click(function() {
        $('#admin_pass').password('toggle');
    });
});

If I click on the show password button initially, it works

image

But if I click on the checkbox first, show password will not show any text

image

Programatically, I get the value of the password field

$('#admin_pass').password('val');
"password"

It's just showing as blank in the password field.

@xjchenhao
Copy link

Me too

@ghost
Copy link

ghost commented Jun 22, 2016

Same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants