Пример:
Запустить событие focus.
"jQuery"
$("input").focus(function () {
$(this).next("span").css('display','inline').fadeOut(1000);
});
"HTML"
<input type="text" /> <span>focus fire</span>
<input type="password" /> <span>focus fire</span>
"CSS"
span {display:none;}
"Живой пример jQuery"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="http://slyweb.ru/css/jqueryiframe.css"
rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("input").focus(function () {
$(this).next("span").css('display','inline').fadeOut(1000);
});
});
</script>
</head>
<body class="iframe">
<input type="text" /> <span>focus fire</span>
<input type="password" /> <span>focus fire</span>
</body>
</html>
<style>
span {display:none;}
</style>
Пример:
Запретить пользователю вводить текст в поле input: