Skip to content Skip to sidebar Skip to footer

Modify Attribute Of Element

I would like to know if there exists a way to modify the attributes of an element (for example a select) using a JsCmd in lift. Here the working version I have for now, running th

Solution 1:

You can use the JqJE library included in Lift which provides a programatic wrapper around JQuery.

The following snippet will create a link that will set the width attribute of #select_id to 30px when clicked.

"#link *" #> a( () => JqId("select_id") ~> JqAttr("width","30px"), Text("clickme"))

This code snippet provides a full example: https://gist.github.com/725432


Solution 2:

You should be able to use a CSS selector in your snippet, like:

"#select_id [width]" #> scala.xml.Text("30px")

That will modify the attribute width on the element with id select_id and set it to 30px.


Post a Comment for "Modify Attribute Of Element"