我有以下简单的标记,它将鼠标悬停在正文中的按钮上时显示彩色引导工具提示。工具提示文本目前被硬编码到jquery函数中。我想通过按钮标记将工具提示文本传递给jquery函数。这个怎么做? (这最终将asp.net标记)如何将参数传递给jquery以从html元素中的元素引导工具提示文本
<html>
<title>toolTips</title>
<head>
<script type="text/javascript" src="jqueryScripts\jquery-2.1.0.js"></script>
<script type="text/javascript" src="jqueryScripts\bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="jqueryScripts\bootstrap-combined.min.css">
<style type="text/css">
.red-tooltip + .tooltip > .tooltip-inner {background-color: #f00;}
.red-tooltip + .tooltip > .tooltip-arrow { border-bottom-color:#f00; }
</style>
<script type='text/javascript'>
$(
function(){
$('#userNameField').tooltip({
'placement': 'bottom',
'title': "...this is a test tooltip..."
});
});
</script>
</head>
<body>
<input type="submit" class="red-tooltip" id="userNameField" value="button1">
</body>
</html>
非常好。我也会试试这个。如果我想出的答案不适用于asp.net boundfields,也许这个会。非常感谢 –
刚刚尝试过这种技术 - 它也有效。非常高兴有各种各样的方式来完成某件事。 –