문제

Not using any tooltip libraries except whats provided with jQuery by default.
jsfiddle http://jsfiddle.net/bobbyrne01/xZzQ9/
Have input field with tooltip that shows nicely on hover ..

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

jquery setup of tooltip:

$(document).ready(function () {

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

Is it possible to programmically display that same tooltip when the button is clicked? e.g

$("#start").click(function () {
    //show tooltip
});
도움이 되었습니까?

해결책

Assuming that your example snippet follows the API of your tooltip library and from your question, I think that you want to not redirect on submit. If these two things are the case, this code may work

$('#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/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top