▼入力欄には、入力のヒントとなるテキストが表示されています。このヒントテキストは入力欄をクリックすると消えます。入力欄からフォーカスを外すと、入力欄が空の場合、ヒントテキスト以外のテキストが入力されていない場合は、再度ヒントテキストが表示されます。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>設置サンプル</title>
<link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
<!-- JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="/content/lib/jquery/jquery.hint.js"></script>
<script>
$(function() {
// find all the input elements with title attributes
$('input[title!=""]').hint();
});
</script>
<!-- CSS -->
<style type="text/css">
input { padding:5px; border: 2px solid #666; }
input.blur { color: #999; }
</style>
<link rel="stylesheet" type="text/css" href="/common/css/example.css"></head>
<body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1>
<h3 class='h'>実行結果</h3>
<!-- CONTENT -->
<h1><a href='http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/'>jQuery tutorial: Text box hints</a></h1>
<p>▼入力欄には、入力のヒントとなるテキストが表示されています。このヒントテキストは入力欄をクリックすると消えます。入力欄からフォーカスを外すと、入力欄が空の場合、ヒントテキスト以外のテキストが入力されていない場合は、再度ヒントテキストが表示されます。</p>
<!-- CODE -->
<form action="/content/demo/test.php" method="post">
<div><label for="search">Search:</label>
<input type="text" name="seach" value="" id="search" title="by name or ticker" />
<input type="submit" value="Go" />
</div>
</form>
<!-- / CODE -->
<!-- / CONTENT -->
</body>
</html>