简体   繁体   English

除了它的一个子 Jquery 之外,我怎样才能获得innerhtml

[英]How can I get innerhtml except one of its child Jquery

I want to print my elements so I need to get innerHtml of the whole div but I need to hide one element from printed but still found in the main page我想打印我的元素,所以我需要获取整个 div 的innerHtml,但我需要隐藏一个元素而不打印但仍然可以在主页面上找到

My attempt looks like this我的尝试看起来像这样

var printcontent = document.getElementById(el).innerHTML
             +" <div class='row'><span class='glyphicon glyphicon-tasks'></span><b></b></div>"
             + document.getElementById(tble).innerHTML
             + document.getElementById(img).innerHTML;

this works fine but I need to hide the elment ID ="attach"这工作正常,但我需要隐藏 elment ID ="attach"

var panel = document.getElementById(el).innerHTML;
var filteredpanel = panel.remove(document.getElementById("attach").innerHTML)

Using jQuery:使用jQuery:

$('#divID').not('#attach');

or或者

$('#divID:not(#attach)');

Try this尝试这个

$('#attach').hide(); /* hide */
var printcontent = $(el).html() /* assign var */
             +" <div class='row'><span class='glyphicon glyphicon-tasks'></span><b></b></div>"
             + $(tble).html()
             + $(img).html();
$('#attach').show(); /* show again */

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 单击父级,但其子级之一除外-jQuery - click on parent except one of its child - jquery 我如何使用jQuery获取除最后一个元素以外的所有元素 - How can I get every element except the last one with jQuery 如何在jQuery中获取除input type =“ hidden”之外的td innerhtml值 - How to get td innerhtml values except input type=“hidden” in jquery 如何复制 HTML 中某个部分的 innerHTML 并创建它的精确副本作为其子项? - How can I copy the innerHTML of a section in HTML and create an exact copy of it as its child? 我必须 iframe 一个父母和另一个孩子,我想使用 jquery 获得孩子 iframe 的价值,我怎样才能得到? - i have to iframe one parent and other child, i want to get child iframe value using jquery, how can i get? 如何从一个指定的子元素中获取innerHTML - How to get innerHTML from one specify child ELEMENT 我如何仅获取XML子元素(如果存在),除了获取下一个父元素的子元素之外? - How can I only get the XML child element if it exists except getting the child of the next parent? PHP-如何在元素上获取innerHTML? - PHP - How I can get innerHTML on an element? 将div传递给jquery函数并获取其innerhtml - Passing div to jquery function and get its innerhtml 如何解析文档并删除除匹配和ID及其子项之外的所有元素 - How can I parse a document and remove all elements except for one that matches and ID and its children
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM