如何在jquery中以形式显示提示?

时间:2014-07-05 11:44:36

标签: javascript jquery jquery-mobile

我想在我的表单中显示提示。实际上我正在使用dform插件。所以我用Google搜索并找到如何显示提示jquery。我在这个小提琴中找到了一个解决方案 http://jsfiddle.net/xWCTf/19/ 请检查这个小提琴点击输入将显示提示 我在我的小提琴中应用了相同的概念我使用了上面使用的dform和tooltip.js。但是我的工具提示或提示没有出现在fiddle.can中,请告诉我为什么它不显示。 这是我的小提琴 http://jsfiddle.net/48v3u/1/

/* simple css-based tooltip */
.tooltip {
    background-color:red;
    border:1px solid #fff;
    padding:10px 15px;
    width:200px;
    display:none;
    color:#fff;
    text-align:left;
    font-size:12px;

    /* outline radius for mozilla/firefox only */
    -moz-box-shadow:0 0 10px #000;
    -webkit-box-shadow:0 0 10px #000;
}

$("#testSuiteConfigurationform :input").tooltip({

    // place tooltip on the right edge
    position: "center right",

    // a little tweaking of the position
    offset: [-2, 10],

    // use the built-in fadeIn/fadeOut effect
    effect: "fade",

    // custom opacity setting
    opacity: 0.7

});

1 个答案:

答案 0 :(得分:0)

使用JqueryUI可以这样做:

 <script>
   $(function() {
     $(document).tooltip();
   });
 </script>

并将标题添加到输入类型:

<input id="age" title="Your hint goes here.">

确保添加了JqueryUI&amp; Jquery文件引用。