我需要隐藏/显示javascript生成的内容,请参阅以下内容:
$(window).load(function () {
$("body").html('<a href="# id="ipsum">Show Ipsum</a><br />' +
'<p id="lorem_content">Lorem</p><p id="ipsum_content">Ipsum</p>' +
'<p id="dolor_content">dolor</p>');
$("p").hide();
$("p#lorem_content").show();
$("a").live("click", function() {
$("p").hide();
$("p#" + $(this).attr('id') + "_content").show();
});
});?
Run Code Online (Sandbox Code Playgroud)
单击后应显示的内容a#ipsum未显示...为什么?jQuery hide()方法应该只设置为内容" display:none",而不是删除内容,是不是真的?
更改<a href="# id="ipsum"到<a href="#" id="ipsum"在第二行.你忘记了一句话
| 归档时间: |
|
| 查看次数: |
194 次 |
| 最近记录: |