Mit*_*iku 0 html javascript css jquery
我有以下div块
<div class="score-description col-sm-3">
<table class="table table-striped">
<thead>
<th> Score
</th>
<th> Description
</th>
</thead>
<tr>
<td>0</td>
<td>Poor</td>
...
...
</tr>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
单击以下按钮时,我想显示此块.
<Button class="btn btn-warning show-score-description-button">
Score Descriptions
</Button>
Run Code Online (Sandbox Code Playgroud)
我有以下脚本来显示块
$(".show-score-description-button").click(function(){
$(".score-description").show();
})
Run Code Online (Sandbox Code Playgroud)
.score-description类的css是
.score-description{
position: fixed;
z-index: 1;
overflow: scroll;
margin-top:-100px;
height: 50%;
margin-left: 7%;
margin-top: 5%;
background-color: #ffffff;
display: none;
}
.score-description table th{
border: 2px solid #aaaabb;
}
.score-description table td{
border: 2px solid #aaaabb;
}
Run Code Online (Sandbox Code Playgroud)
问题是,当我单击按钮时,块显示并立即隐藏.我错过了什么?
按下你的按钮type="button".目前您button正在提交该页面.因此它显示页面处于默认状态.
<Button type="button" class="btn btn-warning show-score-description-button">
Score Descriptions
Run Code Online (Sandbox Code Playgroud)