2015-11-02 35 views

回答

0

你只需要通过使用Javascript/jQuery的

$("span.tip-content").text("new tooltip") 

用于改变文本的范围内更好地给你的跨度ID和比改变它里面的文本,否则,如果你有多个工具提示跨度所有将更新

这样做

<span class="tip-content" id="myspan">tooltip message</span> 

    $("#myspan").text("new tooltip") 

here the fiddle

0

您可以使用JavaScript并添加ID给小费内容然后调用此:

document.getElementById("tip-content").innerHTML = "new value"; 

或使用jQuery

$(document).ready(function(){ 
    $("span.tip-content").html("new value"); 
}); 
0

你可以做一些事情e:

document.querySelector(".field-tip").addEventListener("mouseover", function (event) { 
     document.querySelector(".tip-content").innerHTML = "My new tooltip message"; 
}); 
0

您需要更改tooltip元素的内容,这很简单。 如果你想反复做它,让它在多个提示工作,你可以做一个函数,是这样的:

function customMessage(ele,message) { 
    var main = document.querySelector(ele), 
     tooltip = main.children[0]; 
    main.addEventListener('mouseover',function() { 
     tooltip.innerHTML = message; 
    }) 
} 

做的第一个参数来徘徊的元素,并有第二是消息是在提示

customMessage('.field-tip',"random message"); 

Example

0

下面的代码将显示工具提示,当鼠标滑过,当你出来的文字信息的显示将变为原来的一个。

<script type="text/javascript"> 
$(document).ready(function(e) { 
    $("span.field-tip").hover(function() { 
    //Print message when mouse in 
    $("span.tip-content").html("Tool tip message"); 
}, function() { 
    //Print message when mouse out 
    $("span.tip-content").html("Empty Tool tip Message"); 
    }); 
}); 

</script>