0

I use tooltip , but it's not work .

   <input type="text"  id="txt_name" />
<button id="bt_ok" >Ok</button>

 function CheckInput() {
            if ($("#txt_name").val() == '') {
                $('#txt_name').focus();
                $('#txt_name').tooltip({ placement: 'top', title: 'Please input name' });
               return false;
            }
           return true;
} 
$('#bt_ok').click(function (e) {
            if (!CheckInput) {
                return false;
            }
});

When i'm not type in textbox,it's focus to textbox but tooltip not show in top textbox . Thank you

1 Answer 1

1

You need to call the CheckInput function, now you are checking the function reference which will always be truthy

$('#bt_ok').click(function (e) {
        if (!CheckInput()) {
            return false;
        }
});
Sign up to request clarification or add additional context in comments.

2 Comments

I type lost the character () , I try it , but it've just not work
@BrianCrist which is the tooltip plugin used?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.