1

I'm hoping I don't need to provide a repro demo here if this question can be answered right away. I'd like to remove all div elements under the parent div with id="daterangescontrol" everytime I upload a file to my Shiny app. So my code is like this:

removeUI(selector = "div#daterangescontrol div")

FYI under div#daterangescontrol, there are div#daterange1, div#daterange2...div#daterange(n) generated dynamically depending on the number of columns in the dataset, which can be converted to Date. My objective is to remove all these div children when a new file is uploaded (new dataset). However. the above line of code can only remove the first child, e.g. div#daterange1. I wonder whether it's because I didn't use the right syntax for the selector. I'm not quite familiar with css. Would anyone please help? Thanks!

EDIT: The demo code is provided in my other question post: How to validate date range input in Shiny please check removeUI in observeEvent(input$file).

Catelinn Xiao
  • 141
  • 1
  • 12
  • rough guess: Did you try: `removeUI(selector = "div#daterangescontrol *")`? Example would be appreciated anyway as potential answers are not only for the OP, but for everyone interested in that question,... – Tonio Liebrand Jun 17 '17 at 00:09
  • @BigDataScientist I tried it, it didn't work either. I've provided the demo in my other question post. Check it if you'd like. Thanks! – Catelinn Xiao Jun 17 '17 at 04:54

1 Answers1

0
removeUI("#daterangescontrol > div", multiple = T)
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
mipu
  • 74
  • 6
  • Your answer could be improved by adding more information on what the code does and how it helps the OP. – Tyler2P Nov 04 '22 at 19:26