隐藏文本的链接有效,但 .show 隐藏文本的链接不显示它,而且我没有看到任何错误。请参阅 jsfiddle:http://jsfiddle.net/tv6WQ/
<head>
<style type="text/css">
#shortandlong {color:red}
#thestory {visibility:hidden}
</style>
</head>
<body>
<span id="shortandlong">This is the short version but click </span><a href="#" id="showme">here...</a><span id="thestory"> now this is the full version</span><br/>
<span id="hideit">This text can be hidden </span>by clicking here <a href="#" id="hideme">here</a><br/>
</body>
js:
$(document).ready(function ()
{ $('#hideme').click(function()
{ $('#hideit').hide('fast');
return false; } );
$("#showme").click(function()
{ $('#thestory').show;
alert('Hello World');
return false; } );
} );
最佳答案
.1。
$('#thestory').show()
不是
$('#thestory').show
.2。将 visibility:hidden
替换为 display: none;
或通过 $('#thestory').css('visibility', 'visible'); 更改可见性
关于javascript - jquery - 可以使文本消失但不能使隐藏文本可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9678021/