I am working on x3dom, now I have a two groups in the xhtml file, I want to show only one group at a time by clicking the button. Here is my code, but it doesn't work, only when I replace hide() with remove() it worked, however by removing the group I don't know how to bring them up a again. Anyone good solutions?

    $("#btn").click(function () {
          Group[DEF="ball"].show();
              Group[DEF="num"].hide();
    });
有帮助吗?

解决方案

IMHO show() and hide() work with CSS properties. remove() removes the element from the DOM so it will not be displayed no more and can not be retrieved that easily (besides using XHR or stuff like that). What you probably want is to set the render attribute like node.attr('render', true); or node.attr('render', false);, respectively

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top