A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://rstudio.github.io/htmltools/reference/tagAppendAttributes.html below:

Append tag attributes — tagAppendAttributes • htmltools

Append (tagAppendAttributes()), check existence (tagHasAttribute()), and obtain the value (tagGetAttribute()) of HTML attribute(s).

tagAppendAttributes(tag, ..., .cssSelector = NULL)

tagHasAttribute(tag, attr)

tagGetAttribute(tag, attr)
Arguments
tag

a tag object.

...

Attributes to append as named argument-value pairs. A named argument with an NA value is rendered as a boolean attribute (see example).

.cssSelector

A character string containing a CSS selector for targeting particular (inner) tags of interest. At the moment, only a combination of type (e.g, div), class (e.g., .my-class), id (e.g., #myID), and universal (*) selectors within a given simple selector is supported. Note, if .cssSelector is used, the returned tags will have their $children fields flattened to a single list() via tagQuery().

attr

The name of an attribute.

Examples
html <- div(a())
tagAppendAttributes(html, class = "foo")
#> <div class="foo">
#>   <a></a>
#> </div>
tagAppendAttributes(html, .cssSelector = "a", class = "bar")
#> <div>
#>   <a class="bar"></a>
#> </div>
tagAppendAttributes(html, contenteditable = NA)
#> <div contenteditable>
#>   <a></a>
#> </div>

tagHasAttribute(div(foo = "bar"), "foo")
#> [1] TRUE
tagGetAttribute(div(foo = "bar"), "foo")
#> [1] "bar"


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4