2011-08-10

Jquery : how to input text to password

What I type in here is the tips for newbie, and no worry about the code I use. Actualy my code lack of css (design). The reason because I want to share and less coding for your understanding.
This code using very basic HTML tag and since lack of css, you can add this with your customize to make better.

Change input Text to password
If you see Twitter login page, you can see the password input show 'input password here' but if you click the input are empty.
I want to create the Same, but actually I'm not add the last event..
if the box empty.. it will show 'input password'
create the last command is not easy but to study purpose, let's ignore it first
<div id=pass1>
    <input type=text value='input password here' 
     id='fake' />
</div>
<
script>
$(
document).ready(function() {
    $(
"#fake").click(function(){
        $(
"#pass1").html('<input type=password name=pass />');
    });

});
 

</script>

Tidak ada komentar: