Home >Web Front-end >JS Tutorial >Parent node gets the string sample code of the child node_javascript skills

Parent node gets the string sample code of the child node_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:58:121083browse

1、JavaScript方法:document.getElementById("id").innerHTML;

(1)实例说明

复制代码 代码如下:





获取HTML中的子项


























(2)点击按钮后,弹出信息
Parent node gets the string sample code of the child node_javascript skills 
2、jQuery中的方法:$("#id").html()

(1)实例说明
复制代码 代码如下:





jQuery中父节点获取子节点字符串









































(2)运行结果
Parent node gets the string sample code of the child node_javascript skills
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn