![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I am trying to display the child element in the DOM, while hiding the parent using JS and CSS, however I cannot find a way to do this. So for example: body div id="Parent" div id="child_1"></div p id="child_2"></p /div /body I am trying to hide "Parent", and "child_1" and show "child_2". I cannot change the possition in the actual mark up so i need script to do this. and so far hiding Parent using: $("Parent").style.display="none"; Hides all the child elements. Do anyone know how I can do this? or an alternative method to achive the same result? |
#3
| |||
| |||
|
|
On 4 Jun, 12:16, dwe... (AT) gmail (DOT) com wrote: Hi, I am trying to display thechildelement in the DOM, while hiding the parentusing JS and CSS, however I cannot find a way to do this. So for example: body div id="Parent" * *<div id="child_1"></div * *<p id="child_2"></p /div /body I am trying to hide "Parent", and "child_1" and show "child_2". *I cannot change the possition in the actual mark up so i need script to do this. and so far hidingParentusing: $("Parent").style.display="none"; Hides all thechildelements. Do anyone know how I can do this? *or an alternative method to achive the same result? Just hide all thechildelements that you do not want?- Hide quoted text - - Show quoted text - |
#4
| |||
| |||
|
|
Its not quite that simple, as this is a small example the one i'm using has hundreds, also the parent does formatting which i want to remove, so hiding parent would take care of all of this in one hit. Hididng and changing styles for all would mean lines and lines of code. Thanks |
#5
| |||
| |||
|
|
body div id="Parent" div id="child_1"></div p id="child_2"></p /div /body I am trying to hide "Parent", and "child_1" and show "child_2". I cannot change the possition in the actual mark up so i need script to do this. |
|
and so far hiding Parent using: $("Parent").style.display="none"; Hides all the child elements. |
|
Do anyone know how I can do this? or an alternative method to achive the same result? |
#6
| |||
| |||
|
|
* > Its not quite that simple, as this is a small example the one i'm using has hundreds, also theparentdoes formatting which i want to remove, sohidingparentwould take care of all of this in one hit. Hididng and changing styles for all would mean lines and lines of code. *Thanks You could create a sibling to theparentelementand place it directly after thatparentelement. Then move thechildyou want to save to the newparent Then make the oldparentinvisible Might need some refinement, but the principle is there |
#7
| |||
| |||
|
|
Dan, I've played around with scripting the concept you've mentioned, it's quite abit of manipulation |
![]() |
| Thread Tools | |
| Display Modes | |
| |