Question

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();
    });
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top