In HTML there are tags such as
<div id="abc">TEXT HERE</div> Wha开发者_如何学编程t would you cal lthe text here part? I thought about calling it value, but value itself is an attribute of a tag.Everything from the start tag to the end tag is an "HTML Element" The bit you refer to is the element content
It depends, on what exactly you are referring to:
- Is it anything that's within the
<div>
tag? - Is it just the text within the
<div>
tag? - Is it just the first text node within the
<div>
tag? - Are you talking about HTML as a language, or about a DOM model of HTML, or about an API accessing the HTML?
- ...
The question is not so easy to answer. Some examples:
- With JavaScript, you can use
innerText
to refer to the text content, whereas you would useinnerHTML
to refer to any HTML content. - With a DOM library like Dom4j, the generic term for the string within an element is determined by
getStringValue()
- With XSLT, you can use the
string()
method to retrieve the text - ...
My personal answer would be to call it the (inner) text of an element.
精彩评论