Search code examples
scala.jsscalatags

How to ad "data-" attributes in Scalatags


I want to define an input with extended attributes using the "data-" notation. So for example to define:

<input type="radio" id="3" data-extra="three"/>

Is there a way to do this in Scalatags?


Solution

  • You can use "data-extra".attr to create custom attributes. For example

    input(tpe := "radio", id := "3", "data-extra".attr := "three")