outerhtml

can't change outerHTML with javascript

落花浮王杯 提交于 2021-01-28 21:29:32
问题 I have this HTML template on a page: <div id="bid_wrapper_[[bid_id]]_[[template]]"> <div class="form_item_block" id="bid_wrapper_[[bid_id]]_[[template]]"> <div id="bid_delete_[[bid_id]]_[[template]]"><img src="/images/icons/cross.png"></div> <div id="bid_label_wrapper_[[bid_id]]_[[template]]">Bid #1</div> <div><input type="text" name="bid_summary" id="bid_summary_[[bid_id]]_[[template]]"></div> <div><input name="bid_price" id="bid_price_[[bid_id]]_[[template]]"></div> </div> </div> I'm trying

How to use outerHTML in JavaScript? [closed]

萝らか妹 提交于 2019-12-03 07:09:52
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . How to use outerHTML in JavaScript? Thanks 回答1: The outerHTML is the HTML of an element including the element itself. Contrast this with the innerHTML of the element, which is the HTML contained within an elements opening and closing tags. By definition, elements without both

get opening tag including attributes - outerHTML without innerHTML

浪子不回头ぞ 提交于 2019-11-30 14:47:50
问题 I would like to retrieve a certain tag element with its attributes from the DOM. For example, from <a href="#" class="class"> link text </a> I want to get <a href="#" class="class"> , optionally with a closing </a> , either as a string or some other object. In my opinion, this would be similar to retrieving the .outerHTML without the .innerHTML . Finally, I need this to wrap some other elements via jQuery. I tried var elem = $('#some-element').get(0); $('#some-other-element').wrap(elem); but

get opening tag including attributes - outerHTML without innerHTML

回眸只為那壹抹淺笑 提交于 2019-11-30 11:34:08
I would like to retrieve a certain tag element with its attributes from the DOM. For example, from <a href="#" class="class"> link text </a> I want to get <a href="#" class="class"> , optionally with a closing </a> , either as a string or some other object. In my opinion, this would be similar to retrieving the .outerHTML without the .innerHTML . Finally, I need this to wrap some other elements via jQuery. I tried var elem = $('#some-element').get(0); $('#some-other-element').wrap(elem); but .get() returns the DOM element including its content. Also var elem = $('#some-element').get(0); $('

Display HTML markup in browser without it being rendered

耗尽温柔 提交于 2019-11-29 04:49:08
Starting to implement Javascript, I need to do troubleshooting and would like to output HTML to the screen without it being rendered. I can access the element (in IE) by document.getElementById("test").outerHTML I think, but I can't prove what I'm getting to be sure. So what do I do to have document.write show the entire element including tags? Do two things (all of these, not just one): Replace HTML markup with entities: HTML.replace(/&/g, '&').replace(/</g, '<') is enough. Wrap it in <pre></pre> tags so the whitespace is not eliminated and it is shown in a monospace font. You can also alert

Display HTML markup in browser without it being rendered

让人想犯罪 __ 提交于 2019-11-27 22:32:05
问题 Starting to implement Javascript, I need to do troubleshooting and would like to output HTML to the screen without it being rendered. I can access the element (in IE) by document.getElementById("test").outerHTML I think, but I can't prove what I'm getting to be sure. So what do I do to have document.write show the entire element including tags? 回答1: Do two things (all of these, not just one): Replace HTML markup with entities: HTML.replace(/&/g, '&').replace(/</g, '<') is enough. Wrap it in

outerHTML of an SVG element

橙三吉。 提交于 2019-11-27 21:14:20
Why can not we get outerHTML of an svg element with element.outerHTML property? Is this way is the best http://jsfiddle.net/33g8g/ for getting svg source code? It's not accessible via outerHTML because SVG is not HTML -- it's a separate XML specification . That's why, for example, your svg node in that example has its own namespace defined ( xmlns="http://www.w3.org/2000/svg ). Your example may be the most expedient for a one-off query, but it's actually possible to dig in using native attributes. It just takes a bit more work. Let's use the linked sample node: <svg xmlns="http://www.w3.org

outerHTML of an SVG element

萝らか妹 提交于 2019-11-26 23:01:49
问题 Why can not we get outerHTML of an svg element with element.outerHTML property? Is this way is the best http://jsfiddle.net/33g8g/ for getting svg source code? 回答1: It's not accessible via outerHTML because SVG is not HTML -- it's a separate XML specification. That's why, for example, your svg node in that example has its own namespace defined ( xmlns="http://www.w3.org/2000/svg ). Your example may be the most expedient for a one-off query, but it's actually possible to dig in using native

How to return outer html of DOMDocument?

戏子无情 提交于 2019-11-26 00:34:12
问题 I\'m trying to replace video links inside a string - here\'s my code: $doc = new DOMDocument(); $doc->loadHTML($content); foreach ($doc->getElementsByTagName(\"a\") as $link) { $url = $link->getAttribute(\"href\"); if(strpos($url, \".flv\")) { echo $link->outerHTML(); } } Unfortunately, outerHTML doesn\'t work when I\'m trying to get the html code for the full hyperlink like <a href=\'http://www.myurl.com/video.flv\'></a> Any ideas how to achieve this? 回答1: As of PHP 5.3.6 you can pass a node