我是新来的Jquery,我有一个要求,以显示额外的文本,只有当在各自的行显示/隐藏在各自的选择多选择
鼠标悬停我怎样才能改变我的jQuery的片段,而无需编写相同的代码片段10次为10个不同的选择
这里的代码:
<html>
<head>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script >
jQuery(function() {
$("#demoTable1").hide();
$("#demo1").mouseover(function() {
$("#demoTable1").show();
});
$("#demo1").mouseout(function() {
$("#demoTable1").hide();
});
$("#demoTable2").hide();
$("#demo2").mouseover(function() {
$("#demoTable2").show();
});
$("#demo2").mouseout(function() {
$("#demoTable2").hide();
});
});
</script>
<style>
tr {
background: #b8d1f3;
}
td {
font-size: 12px;
color: #000;
}
</style>
</head>
<body>
<table>
<tr>
<td id='demo1'> Service : All services are running
<div id='demoTable1'> some text here 1 </div>
</td>
</tr>
<tr>
<td id='demo2'> Service : All services are running
<div id='demoTable2'> some text here 2 </div>
</td>
</tr>
</table>
</body>
</html>
非常感谢......它完全符合我的要求。它的工作现在 – sunny
不客气!如果它正确回答您的问题,请将其标记为正确答案。 –