<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<form action="">
<input type="text" id="username">
<input type="button" value="submit">
</form>
<script src="lib/jquery-2.2.2.js"></script>
<script>
$(function(){
// $('#username').keyup(function(e){
// if(e.key==='a'){
// $(this).val($(this).val().replace('a','A'));
// }
// });
// $('#username').keyup(function(e){
// $(this).val('123456789');
// });
//trigger触发器 自动执行
// $('#username').trigger('keyup');
$('#username').focus(function(){
$(this).css('border','1px solid red');
}).trigger('focus');
});
</script>
</body>
</html>