get value of child
of a parent

后端 未结 6 720
面向向阳花
面向向阳花 2021-01-13 06:50
some-value

how do I get \"some-value\"? I tried

<
6条回答
  •  余生分开走
    2021-01-13 07:19

    document.getElementById("output").innerHTML = document.getElementById("child").innerHTML;

    This will solve your problem.

    Using your way of approach try as shown below

    var parent = document.getElementById("parent");
    var child = parent.childNodes[0];
    

    var childval = child.innerHTML;

    document.getElementById("outPut").innerHTML=childval;
    

    This will also solve your problem

提交回复
热议问题