【发布时间】:2026-02-17 10:00:01
【问题描述】:
我试图在选择“显示更多”链接时显示 div 标签。到目前为止,页面加载时会出现 div,这是我不想要的。然后,当我选择“显示”链接时,div 消失了。我需要相反的情况发生,然后当我再次选择链接时让 div 消失。
这是我的 HTML:
<div class="VideoText" align="left">
<a href=""><span> <strong> Credits </strong> </span></a>
<br> Directed By: <a href="#"> Link One </a>
<br> Edited By: <a href="#"> Link Two </a>
<br>
<a href="#" id="hideshow">Show</a>
<div id="message">
Credit: <a href="#"> Link Three </a> <br>
Credit: <a href="#"> Link Four </a> <br>
</div>
</div>
这是我的 .js 文件:
$('#hideshow') .click(function() {
$('#hideshow') .text('Hide');
$('#message') .show();
}, function() {
$('#hideshow').text('Show');
$('#message') .hide();
});
我觉得我只是在错误的地方放了一些代码。
这是我试图让代码工作的页面: http://www.kingdombrand.com/Film/Alek/Films/TestFilm
【问题讨论】:
标签: javascript html show