Why isn't the jQuery changing the type attribute of #password_input to password?
<html>
<head>
<title></title>
<style type="text/css">
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#password_input").attr('type','password');
});
</script>
</head>
<body>
<div id="loginBox">
<form>
<input type="text" id="username_input" name="username" /><br />
<input type="text" id="password_input" name="password" />
</form>
</div>
</body>
</html>
Have you tried using .prop?
$("#password_input").prop('type','password');
http://api.jquery.com/prop/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With