get value of child
of a parent

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

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

<
6条回答
  •  执念已碎
    2021-01-13 07:30

    try this way by this pointer.

    var childs = document.getElementById('myDropdown').children; //returns a HTMLCollection
    
    for (var indx = 0; indx < childs.length; indx++) {
        // iterate over it
        childs[indx].onclick = function() {
            // attach event listener On Symbole Dive THIS . 
            this.style.color = "#ff0000";
            // add to note form the symbole .
            document.getElementById("Note_form").value += this.innerHTML;
    
    
        }
    }
    
            
              

提交回复
热议问题