Home > front end >  Getelementbyid to obtain the values in the loop will not change
Getelementbyid to obtain the values in the loop will not change

Time:02-19






Each time I want to click onclock p.i in the current cycle d value, but can only get the first p.i d value, get behind will not change, like me in the first box click, can get to 2299431, want to take a second to 2299432, but still get to 2299431,

CodePudding user response:

HTML id attribute is the unique identifier of a node, not allowed to duplicate id, you this cycle, obviously the first column of each row ids are aaa, use getelementbyid will only take a match to the first node,
You can try this
 






 
The function updata (e) {
Var e=window. The event | | the arguments. The callee. Caller. The arguments [0].
E. arget. The closest (' tr.) querySelector (' aaa '). The innerText=e. arget. Value
}

CodePudding user response:

refer to the original poster is doraemon, please reply:
& lt; Span>




Each time I want to click onclock p.i in the current cycle d value, but can only get the first p.i d value, get behind will not change, like me in the first box click, can get to 2299431, want to take a second to 2299432, but still get to 2299431,

In addition, I tried, in the span tag should not write the tr block elements, the page could be a problem parsing the DOM node,
  • Related