Retrieves the value indicating whether the object can contain rich HTML markup.
Syntax
| HTML | <element canhavehtml="p" ... > |
|---|---|
| JavaScript | |
Property values
Type: Boolean
Remarks
The property is read-only for all objects except the following, for which it is read-write: defaults.
Examples
The following example shows how to use the canHaveHTML property to determine whether an object can contain HTML markup.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function answer(arg) {
arg ? console.log("Yes") : console.log("No");
}
</script>
</head>
<body>
<p>Input: <input type="text" id="oInput" value="oInput" /></p>
<p><button onclick="answer(oInput.canHaveHTML);">
Can the INPUT contain HTML?
</button> </p>
<p>Span: <span id="oSpan">oSpan</span></p>
<p><button onclick="answer(oSpan.canHaveHTML);">
Can the SPAN contain HTML?
</button></p>
</body>
</html>
See also
- a
- abbr
- address
- area
- b
- base
- bdo
- blockQuote
- body
- br
- button
- caption
- cite
- code
- col
- colGroup
- comment
- custom
- dd
- defaults
- del
- div
- dl
- dt
- em
- embed
- fieldSet
- form
- head
- hn
- hr
- html
- i
- iframe
- img
- input type=button
- input type=checkbox
- input type=file
- input type=hidden
- input type=image
- input type=password
- input type=radio
- input type=reset
- input type=submit
- input type=text
- ins
- kbd
- label
- legend
- li
- link
- map
- object
- ol
- option
- p
- pre
- q
- rt
- ruby
- s
- samp
- script
- select
- small
- span
- strong
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- title
- tr
- u
- ul
- var
Build date: 11/28/2012