Home > Web Front-end > JS Tutorial > body text

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

WBOY
Release: 2016-05-16 16:58:12
Original
1026 people have browsed it

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
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template