I'm trying to find the span:
<span class="input-group-text">per month</span>
in the following HTML snippet via htmltools::tagQuery:
<div class="form-group shiny-input-container" style="width:160px;">
<label class="control-label" for="numericInputIconId">numericInputIcon</label>
<div class="input-group">
<input id="numericInputIconId" type="number" class="form-control numeric-input-icon" value="5" min="0" max="10"/>
<div class="input-group-addon sw-input-icon input-group-append">
<span class="input-group-text">per month</span>
</div>
</div>
<span class="help-block invalid-feedback hidden d-none"></span>
</div>
However $selectedTags() remains empty:
tagQ <- htmltools::tagQuery(
shinyWidgets::numericInputIcon(
inputId = "numericInputIconId",
label = "numericInputIcon",
value = 5,
min = 0,
max = 10,
width = "160px",
icon = list(NULL, "per month")
)
)
tagQ$find("span")$selectedTags() # only finds the help-block span: [[1]] <span class="help-block invalid-feedback hidden d-none"></span>
tagQ$find(".input-group-text") # `$selectedTags()`: (Empty selection)
tagQ$find(".input-group")$find("div") # `$selectedTags()`: (Empty selection)
tagQ$find("#numericInputIconId")$siblings("div") # `$selectedTags()`: (Empty selection)
What am I missing here?
Related articles: