0
if($jq(this).text() == "Show") {
    $jq('#password')[0].type = "text";
} else {
    $jq('#password')[0].type = "password";
}

In my program, I am changing type of password input field on clicking hide or show password button.

the above code works fine with all the browsers except IE.

anyone plz help me with solution. Thanks

1 Answers1

0

Try

.attr()

if($jq(this).text() == "Show") {
    $jq('#password').attr("type","text");
} else {
    $jq('#password').attr("type","password");
}

or better use .prop

if($jq(this).text() == "Show") {
    $jq('#password').prop("type","text");
} else {
    $jq('#password').prop("type","password");
}

Read .prop() vs .attr()

Community
  • 1
  • 1
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107