【发布时间】:2015-06-19 02:25:37
【问题描述】:
我需要在 Query 中隐藏一个元素段落,但我希望该元素段落被隐藏并保留它的位置,下面的按钮不能代替段落
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#hide").click(function(){
$("p").hide();
});
$("#show").click(function(){
$("p").show();
});
});
</script>
</head>
<body>
<p>If you click on the "Hide" button, I will disappear.</p>
<button id="hide">Hide</button>
<button id="show">Show</button>
</body>
</html>
【问题讨论】:
-
将此
style="visibility:hidden;"添加到段落标签中。
标签: jquery jquery-ui jquery-mobile jquery-plugins