A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/HTMLElement/canHaveHTML below:

canHaveHTML ยท WebPlatform Docs

canHaveHTML

Property of dom/HTMLElementdom/HTMLElement

Syntax
var result = element.canHaveHTML;
element.canHaveHTML = value;
Examples

The following example shows how to use the canHaveHTML property to determine whether an object can contain HTML markup.

<HTML>
<HEAD>
<SCRIPT>
function answer(arg) {
    arg ? alert("Yes") : alert("No");
}
</SCRIPT>
</HEAD>
<BODY>
<P>INPUT: <INPUT type="text" ID="oInput" VALUE="oInput" /></P>
<P>SPAN: <SPAN ID="oSpan">oSpan</SPAN></P>
<BUTTON onclick="answer(oInput.canHaveHTML);">
Can the INPUT contain HTML?
</BUTTON>&nbsp;
<BUTTON onclick="answer(oSpan.canHaveHTML);">
Can the SPAN contain HTML?
</BUTTON>
</BODY>
</HTML>

View live example

Notes Remarks

The property is read-only for all objects except the following, for which it is read-write: defaults.

Syntax Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4