-
Book Overview & Buying
-
Table Of Contents
Lift Application Development Cookbook
By :
Suppose you are building a page and you want to show some unique information, such as the user name and the total amount of a shopping cart; what would you do?
You will probably need to add the information that you want to show into some tags with a unique identifier.
This is exactly what we will learn to do in this recipe.
You can use the code from the examples we used in the recipes of the previous chapter or you can start a new project.
An HTML element can be transformed by using the following steps:
Add the following code into the index.html file:
<div data-lift="Calculator.plus"> 2 + 2 = <span id="result">some number</span> </div>
Create a Calculator object inside the snippet folder with the following code:
import net.liftweb.util.BindHelpers._
object Calculator {
def plus = "#result *" #> (2 + 2)
}Start the application and access http://localhost:8080. You should see a page similar to the...
Change the font size
Change margin width
Change background colour