Skip to content

FR: extract HTML text from tags #440

@ismirsehregal

Description

@ismirsehregal

Coming from here.

I'm wondering whether there is a way to extract the HTML text ("mylabel" in the example below) from a tag via {htmltools}.

Currently the following

library(htmltools)
library(shiny)

tagQuery(actionButton(
  inputId = "myid",
  label = "mylabel",
  icon = icon("home")
))$children()

results in:

`$allTags()`:
<button id="myid" type="button" class="btn btn-default action-button">
  <i class="fas fa-house" role="presentation" aria-label="house icon"></i>
  <span class="shiny-icon-separator"></span>
  mylabel
</button>

Error in (function (el, i)  : 
  `setSelected(selected=)` received a list item at position `3` that was not a tag environment

Related:

https://rvest.tidyverse.org/reference/html_text.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions