June 24, 2013

Javascript tooltip only appears on second hover

Ghostmancer’s Question:

I am using jQuery and Twitter Bootstrap, and want to have a tooltip appear when hovering over a link. However, the tooltip doesn’t appear the first time I hover over a link, but if I move the mouse away and back on, it works every time for that link.

I have several of these on the page:

<a href="#" onmouseover="$(this).tooltip();" class="postAuthor" data-original-title="@username">Full Name</a>

I’ve created a jsFiddle to demonstrate: jsFiddle. Any help would be appreciated – thanks in advance!

.tooltip() functions initiates the tooltip effect on the link, not show the tooltip

Explanation:

When the $(this).tooltip() is triggered on the first hover, it instantiate the plugin first. Then finally on the second hover you get the tooltip.

Solution:

Add this on your code:

$(function() {
    $("a").tooltip();
});

Solution

April 4, 2012

How do I make bootstrap table rows clickable?

Question by rjurney

I can hack this myself, but I think bootstrap has this capability.

Answer by Terry

Using jQuery it’s quite trivial. v2.0 uses the table class on all tables.

$('.table > tr').click(function() {
    // row was clicked
});

Answer by Starx

May be you are trying to attach a function when table rows are clicked.

var table = document.getElementById("tableId");
var rows = table.getElementsByTagName("tr");
for (i = 0; i < rows.length; i++) {
    rows[i].onclick = functioname(); //call the function like this
}
...

Please fill the form - I will response as fast as I can!