0

Is it possible to invoke the <noscript> element even when JavaScript is enabled? I need to toggle it's visibility for demonstration purposes of what it will look like.

4

2 回答 2

3

您可以使用 中的内容创建一个新<div>元素,<noscript>然后在演示后将其删除:

// to create
var div = document.createElement("div");
div.innerHTML = document.getElementsByTagName("noscript")[0].innerHTML;
document.body.appendChild(div);

// to remove
document.body.removeChild(div);
于 2013-04-18T18:28:07.163 回答
-1
<noscript>stuff</noscript>
<div id="mydiv"><div>

$('#mydiv').text($('noscript').text());

http://jsfiddle.net/5pD​​BT/

于 2013-04-18T18:31:15.107 回答