Siggy Petersen
Siggy Petersen

Reputation: 205

Lift change/remove DOM attribute

Hey i have a little issue and don't find any solution. When my lift app starts first time a select box is disabled by the "disable" attribute. After the user has clicked on button, i want to enable the select box. I tried the following line

"#car_select [disabled]" #> (None:Option[String])

to remove the "disabled" attribute, but this actually doesn't work. Is there another methode to manipulate or remove DOM attributes?

Upvotes: 0

Views: 327

Answers (1)

Dave Whittaker
Dave Whittaker

Reputation: 3102

I don't think there is a CSS Selector rule to remove an attribute, you can try something like this though:

"#car_select" #> { xml: NodeSeq => 
  xml match {
    case e: Elem =>
      Elem(e.prefix, e.label, e.attributes.remove("disabled"), e.scope, e.child)
    case other => other
  }
 }

Upvotes: 2

Related Questions