我有一个简单的点击和显示,点击和隐藏按钮,但当我点击它时,页面锚定在页面的顶部.反正有没有阻止这个?那么当我点击按钮时,我会在浏览器中停留在同一个地方?
我的代码是......
$('#reportThis').hide();
$('#flagThis').click(function () {
$('#reportThis').show("slow");
});
$('#submitFlag').click(function () {
$('#reportThis').hide("slow");
});
Run Code Online (Sandbox Code Playgroud)
Dar*_*rov 18
试试这个:
$('#reportThis').hide();
$('#flagThis').click(function (evt) {
$('#reportThis').show("slow");
evt.preventDefault();
});
$('#submitFlag').click(function (evt) {
$('#reportThis').hide("slow");
evt.preventDefault();
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11781 次 |
| 最近记录: |