1. 使用下面的代码将jQuery Tooltip整合到表单中。添加一个自定义HTML并添加下面的代码。相应修改。

    <script type="text/javascript">
    $(function() {
    
    //customize your hints here by specifying form element ID on the left and message on the right
    messages = { 'title' : 'Key in a suitable title',
                'remark' : 'Extra note goes here'};
     
    //do not modify anything below here.
    $( document ).tooltip({
          items: "input",
          content: function() {
            var element = $( this );
            if( messages[$(element).attr("name")] ){
              return messages[$(element).attr("name")];
            }else{
              return false;
            }
          }
        });
        
    });
    </script>
  2. 当有人把鼠标停留在字段上面时,就会显示

     

Reference: http://api.jqueryui.com/tooltip/

  • No labels