[jQuery Form Notifierライブラリ] テキストフィールド内にヒント文字を表示する

説明

jQuery Form Notifierライブラリでテキストフィールド内にヒント文字を表示するには、ヒントとなる文字を表示したいテキストフィールドのtitle属性に表示するヒント文字を指定します。

サンプルプログラム

【HTML】
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="css/main.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="js/jquery.formnotifier.js"></script>
<script type="text/javascript" src="js/sample.js"></script>
</head>
<body>
<h1>テキストフィールド内にヒント文字を表示</h1>
<form>
名前:<input type="text" name="username" size="20" value="" title="なまえをいれてね"><br>
年齢:<input type="text" name="userage" size="20" value="" title="としをいれてね"><br>
趣味:<input type="text" name="userhobby" size="20" value="" title="しゅみをどうぞ"><br>
<input type="submit" value="送信">
</form>
</body>
</html>


【sample.js】
$(function(){
$(":text").formNotifier();
})
サンプルを実行
[戻る]