Home >Web Front-end >JS Tutorial >Password box displays prompt text jquery example_jquery

Password box displays prompt text jquery example_jquery

WBOY
WBOYOriginal
2016-05-16 17:23:531009browse
复制代码 代码如下:



登录

<script> <br>$(document).ready(function(){ <br>$(".text_login").focus(function(){ <br>if($(this).val()=='user name' || $(this).val()=='password'){ <br>$(this).val(''); <br>} <br>if($(this).attr('id')=='password1'){ <br>$(this).hide(); <br>$('#password2').show(); <br>$('#password2').focus(); <br>} <br>}); <br>$(".text_login").blur(function(){ <br>if($(this).attr('id')=='password2' && $(this).val()==''){ <br>$(this).hide(); <br>$('#password1').show(); <br>$('#password1').val('password'); <br>} <br>else if($(this).attr('id')=='uname' && $(this).val()=='' ){ <br>$(this).val('user name'); <br>} <br>}); <br>}); <br></script>















Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn