<p>hello</p>
<button id="toggle">隐藏/显示</button>
首先在body标签中写上如上代码
$(document).ready(function(){
$("#toggle").click(function(){
$("p").toggle(1000);
});
});
接着在js文件中写上如上代码
你可以通过点击按钮,来进行hello的显示和隐藏
注:你需要提前引入jQuery文件和js文件
<p>hello</p>
<button id="toggle">隐藏/显示</button>
首先在body标签中写上如上代码
$(document).ready(function(){
$("#toggle").click(function(){
$("p").toggle(1000);
});
});
接着在js文件中写上如上代码
你可以通过点击按钮,来进行hello的显示和隐藏