Brian Crist
Brian Crist

Reputation: 814

How to use tooltip bootstrap in asp.net?

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

Upvotes: 0

Views: 81

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

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;
        }
});

Upvotes: 1

Related Questions