<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>移动端开发注册、登陆input常用事件(input输入文字触发事件)</title>
<meta name="keywords" content="积分商城、兑换,春游兑换季,免费"/>
<meta name="description" content="积分春游兑换季,更多车主出行超值商品免费兑换"/>
<meta http-equiv="content-language" content="zh-cn" />
<meta http-equiv="x-ua-compatible" content="ie=emulateie7" />
<meta name="copyright" content="本页版权归IICOO所有。All Rights Reserved" />
<meta name="author" content="IICOO" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<meta content="black-translucent" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<link rel="stylesheet" href="http://wappass.baidu.com/static/touch/css/base_19c066f0.css"/>
</head>
<body>
<div id="pageWrapper">
<header class="pass-header">
<a class="pass-header-back" id="goBack"></a> <span class="pass-header-title"> <span class="pass_header_logo">登录帐号</span> </span> <a class="pass-header-links" href="#">注册</a>
</header>
<div class="mod-content">
<form autocomplete="off" method="POST" class="form-wrapper" id="login-formWrapper">
<p class="error_area" id="error"></p>
<p class="form-item form-input-wrapper form-item-username">
<label class="text-label text-label-username" for="login-username" id="login-label-username">帐号</label>
<input type="text" name="username" class="text-input" maxlength="60" placeholder="手机号/邮箱/用户名" value="" id="login-username"> <span class="input-clearValue"></span>
</p>
<p class="form-item form-input-wrapper">
<label class="text-label text-label-password" for="login-password" id="login-label-password">密码</label>
<input type="password" name="password" class="text-input" id="login-password" placeholder="密码" value=""> <span class="input-clearValue"></span> <span id="login-pwdToggle" class="input-aide input-pwdToggle"></span>
</p>
<p class="form-item"> <span class="form-input-wrapper"> <label class="text-label text-label-verifyCode " for="login-verifycode">验证码</label> <input type="text" name="verifycode" class="text-input" value="" placeholder="验证码" autocomplete="off" maxlength="6" id="login-verifycode"> <span class="input-clearValue"></span> </span>
<img class="verifyCode-img" src="http://wappass.baidu.com/cgi-bin/genp_w_picpath?" width="100" height="40" id="login-verifyCodeImg">
<a class="change-verifyCode" id="login-verifyCodeChange"></a>
<input type="hidden" id="login-vcodestr" name="vcodestr" value="">
</p>
<p class="form-item form-item-btn">
<input type="submit" value="登录" id="login-submit" class="pass-button-full pass-button-full-disabled">
</p>
</form>
<p class="m-lr14 f14 clearfix"> <a class="right" href="#">忘记密码?</a>
</p>
</div>
<div class="footer"></div>
</div>
<script type="text/javascript" src="http://baoxian.pingan.com/pa18shopnst/u/wx/product/airDelayNew/js/zepto-1.1.4.build.min.js?t=20151124"></script>
<script type="text/javascript">
//
var $loginUsername = $("#login-username")
var $loginPassword = $("#login-password")
var $loginPwdToggle = $("#login-pwdToggle");
$loginPwdToggle.tap(function(){
//$(this).addClass("input-pwdToggle-show");
//alert("dd");
if($loginPassword.attr("type") == "text"){
$loginPassword.attr("type", "password");
$loginPwdToggle.removeClass("input-pwdToggle-show");
}else{
$loginPassword.attr("type", "text");
$loginPwdToggle.addClass("input-pwdToggle-show")
}
});
//
$loginUsername.on("input",function(){
$(this).siblings(".input-clearValue").css("display","block");
});
//
$loginPassword.on("input",function(){
$(this).siblings(".input-clearValue").css("display","block");
});
//
$(".input-clearValue").tap(function(){
$(this).siblings("input").val("");
$(this).css("display","none");
});
</script>
</body>
</html>
转载于:https://blog.51cto.com/iicoo/1729163