【发布时间】:2015-05-29 14:25:12
【问题描述】:
我目前有一些输出查询结果的 php 脚本。我想在最后添加两个按钮来显示/隐藏最终元素,但不知道该怎么做。
以下是我的php脚本:
while($result = mysqli_fetch_array($iname))
{
echo "<b>Event Name:</b> " .$result['EventName'];
echo "<br> ";
echo "<b>Location:</b> ".$result['Location'];
echo "<br>";
//this is where I would like to add my two buttons, that would show the "hidden" content when clicked
这是我在 HTML 脚本中编写的,我想将其调整到 PHP 输出中:
<!DOCTYPE html>
<html>
<head>
<scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js></script>
<script>
$(document).ready(function(){
$("#hidden").hide();
$("#hide").click(function(){
$("#hidden").hide(500);
});
$("#show").click(function(){
$("#hidden").show(500);
});
});
</script>
</head>
<body>
<button id="show">Show</button>
<button id="hide">Hide</button>
<p id="hidden">
Some Random Text that will be shown when the buttons are clicked
</p>
</body>
</html>
关于如何做到这一点有什么建议吗?
【问题讨论】:
标签: php jquery html function button