javascript - How to hide/show JS-generated content? -
i need hide/show javascript-generated content, see below:
$(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(); }); });
the content, should shows after clicking on a#ipsum
not being shown... why? jquery hide()
method should set content "display:none
", not remove content, isn't true?
change <a href="# id="ipsum"
<a href="#" id="ipsum"
in second line. forgot quote
Comments
Post a Comment