How to change text text of text field using jquery

I have a login component and in it the password field has singlelline text mode

what I'm trying to do is focus the text, which will change to password

I tried this:

$(function () {
   $(".PassTextBox").focus(function (pas) {
       $(".PassTextBox").attr("TextMode", "Password");
   });
});

but it did not work

using asp.net 3.5, thanks

+3
source share
3 answers

You will need to change the "type" attribute to a password. "TextMode" is an asp.net control attribute, but on the client side it turns into an HTML input that has an attribute of the type: http://htmlhelp.com/reference/html40/forms/input.html

$(function () {
$(".PassTextBox").focus(function (pas) {
    $(".PassTextBox").attr("Type", "Password");
});
});

UPDATE: , , , , jQuery. . , / , .

0

?

,

, , IE ( v9) , .

+3

Do it:

$(function () {
  $(".PassTextBox").focus(function (pas) {
    $(".PassTextBox").attr("type", "password");
  });
});

Hope this works.

0
source

All Articles