Hiding text using Javascript / JQuery -
i developing chrome extension , trying hide part of page. new stuff apologies in advance if using wrong terms or question seems obvious!
the page format appears below:
<div class="wrapper"> <span class="loud" style="text-decoration: none;">...</span> <div class="leave-gap">...</div> <quote>...</quote> "*** can't figure how hide ***" <p></p> <span id="id_12345" class="none">...</span> <div class="block-footer">...</div> <div class="leave-gap">...</div> </div>
as snippet suggests, cannot figure out how hide bit highlighted stars.
i have function takes input variable first element in class "wrapper":
function processcomment(commentstart) { $element = commentstart; while($element) { if(some condition) { $element.hide(); } $element.next(); }
because text sitting outside tags, not being picked up. can't hide whole of wrapper class because there bits inside need show.
any suggestions gratefully received.
thanks, richard
set visibility propery or wrapper collapse , set visibility of childrens visible overriding visibility property. hide text node.
$('.wrapper').css('visibility', 'collapse').find('*').css('visibility', 'visible');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div class="wrapper"> <span class="loud" style="text-decoration: none;">...</span> <div class="leave-gap">...</div> <quote>...</quote> "*** can't figure how hide ***" <p></p> <span id="id_12345" class="none">...</span> <div class="block-footer">...</div> <div class="leave-gap">...</div> </div>
Comments
Post a Comment