I have two radio buttons, one for SBT and one for Gradle. How do I specify the text for the buttons in Scala.js? My code looks like this:
lazy val toolChoice = fieldset(
legend("Build Tool"),
input(`type`:="radio", name:="tool", value:="sbt", "SBT"),
input(`type`:="radio", name:="tool", value:="gradle", "Gradle")
).render
I see the buttons, but not the text. What am I doing wrong?
Radio buttons do not have text per se. You need to have a sibling element to display the text. Ideally a <label>
, so that it is clickable. See for example https://stackoverflow.com/a/2350782/1829647
In Scalatags, I guess it would look like this:
lazy val toolChoice = fieldset(
legend("Build Tool"),
input(`type`:="radio", name:="tool", value:="sbt", id:="toolsbt"),
label(`for`:="toolsbt", "sbt"),
input(`type`:="radio", name:="tool", value:="gradle", id:="toolgradle"),
label(`for`:="toolgradle", "Gradle")
).render