J'ai modifié ce code, récupéré dans un autre forum, pour réaliser un hint en jQuery sur des champs d'un formulaire.

Mais voila ça n'a pas marché

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="JavaScript" type="text/javascript" src="js/jquery-1.3.min.js"></script>
<script>
  $(document).ready(function(){
 
    $("input, textarea, select").focus(function () {
         $(this).next("span .hint").addClass('tooltips');
    });
 
	$("input, textarea, select").blur(function () {
         $(this).next("span .hint").removeClass('tooltips')
    });
 
 
  });
  </script>
<style>
   span.hint {
    padding:5px 5px 5px 40px;
	width:120px;
	position:absolute;
	margin: 2px 0 0 14px;
    display:none;
	}
 
   .tooltips{ 
     display:inline;
	 background-color:gray;
   }   
  </style>
</head>
<body>
<p>User Name<br>
  <input type="text" />
  <span class="hint">Enter User Name</span></p>
<p>Password<br>
  <input type="password" />
  <span class="hint">Enter Password</span></p>
</body>
</html>
Ou est l'erreur ?

Merci.