0

不使用任何工具提示库,除了默认情况下随 jQuery 提供的内容。
jsfiddle http://jsfiddle.net/bobbyrne01/xZzQ9/
有带有工具提示的输入字段,在悬停时可以很好地显示..

Name:
<input type="text" id="name" title="Please input your name" />
<button id="start" type="button">Click Me!</button>

工具提示的jquery设置:

$(document).ready(function () {

    $(document).tooltip();
    $("#name").tooltip({
        show: {
            effect: "slideDown",
            delay: 250
        }
    });
});

单击按钮时是否可以以编程方式显示相同的工具提示?例如

$("#start").click(function () {
    //show tooltip
});
4

1 回答 1

1

假设您的示例代码段遵循工具提示库的 API,并且从您的问题来看,我认为您不想在提交时重定向。如果是这两件事,这段代码可能会起作用

$('#start').submit(function(e) {
  e.preventDefault();
  $("#name").tooltip({
    show: {
      effect: "slideDown",
      delay: 250
    }
  });
});

You are grabbing the event object that gets sent in as the first argument to jQuery event functions and stopping it from submitting the page and redirecting, the default action. I hope this is what you meant.

You will have to handle that submit now all by yourself

Update

Here's a fiddle that seems to hit more of the actual question you were asking. http://jsfiddle.net/xZzQ9/3/

于 2013-01-08T02:01:08.673 回答