+ 2

Why doesn't the text content change inside table cells? [Solved]

https://code.sololearn.com/W13wXDB4wO5h/?ref=app

15th Aug 2020, 10:46 AM
Abhay
Abhay - avatar
2 ответов
+ 3
1. When you do the document.select, the view is not yet part of the DOM, because you only add it in the last line. 2. select retrieves only the direct child nodes, so document would only have a single child: html It is much easier to reference DOM elements by ID because the document object keeps track of all IDs as a dictionary. So this modification of your code would work, at least it changes all day names to 'hi' daysrow = html.TR(id='days') daysrow <= [html.TD(x) for x in schedule] view <= daysrow document <= view weekdays=document['days'].select('td') for day in weekdays: day.text = "hi"
15th Aug 2020, 11:51 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Tibor Santa thank you very much
15th Aug 2020, 12:05 PM
Abhay
Abhay - avatar