Link to home
Start Free TrialLog in
Avatar of yingwho
yingwho

asked on

tool tip for error message

i have a error message using jquery. i want to apply z-index and come top on other elements.
in this example i want the error message to come on top of the hello word.
its going to the left, and not coming on top. pl help.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>
<style type="text/css">
.error { float: left; color: red; padding-left: .5em; vertical-align: top; border:1px solid red; z-index:10000; }
.red { color:red; }
</style>
<script>
$(document).ready(function(){
  $("#commentForm").validate({
    rules: {
      username: "required"     
    },
    errorPlacement: function(err,el) {
      var br = $('<br>');
      $(el).before(br);
      err.insertBefore(br);
    }
  });
});
</script>   
</head>
<body>
  <form id="commentForm" method="get" action="">
        <table width="600" cellpadding="2" cellspacing="0">
        <tr><td colspan="2">hello hello hello hello hello hello hello hello hello hello hello hello hello hello hellohellohellohello</td></tr>
		<tr>
            <td width="200px">Username<span class="req">*</span></td>
            <td width="400px"><input id="Username" type="text" name="username" size="25" minlength="2" /></td>
        </tr>       
     </table>           
     <input class="submit" type="submit" value="Submit"/> 
  </form>
</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yingwho
yingwho

ASKER

gr8, thanks. but when i said error message should come on top of hello, it does not mean above.
what i meant was using z-index coming on top overlapping the hello just above the textbox.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial