O'Reilly logo

MooTools 1.3 Cookbook by Jay Larry G. Johnston

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Styling the text within an element

We are often faced with a reason to style text on-the-fly using client-side code. MooTools makes that quite elementary with concepts found prominent in this very recipe!

Getting ready

Prepare to make the text in our SPAN stand out: by making it bold.

How to do it...

It is possible to set the styles of any text element quickly and easily.

<script type="text/javascript" src="mootools-1.3.0.js"></script> </head> <body> <form action="" method="get"> <input id="go_bold" type="button" value="Bold Oscar"/> <input id="go_div" type="button" value="Set Oscar Apart"/> </form> <br/> <div>Every great man nowadays has his disciples, and it is always Judas who writes the biography. <span id="quote_author">Oscar Wilde</span></div> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required