Skip to main content

CODING

jQuery - Key Pressed Events

In this tutorial we're providing example for determining which keyboard's key is pressed. Here is a part of HTML code we'll use for the example:

SilverStripe Syntax Highlighter

A blog dedicated to software design and development, as our company blog is, usually has many articles that contain program code examples. It would be very useful to have code highlighting enabled by default in SilverStripe CMS.

However, we can add it easyily. One of the most used JavaScript tool fo code highlighting is SyntaxHighligher created by Alex Gorbatchev (http://alexgorbatchev.com). We're going to describe the procedure for implementing SyntaxHiglighter to SilverStripe CMS in step-by-step tutorial.

jQuery - Read More.../Read Less... Link

One of very usefull tip is for creating a "Read More..." link when only a few lines of text are displayed and the rest of the text is shown after clicking the link.

jQuery - Element Get/Lost Focus

There are two important jQuery functions for dealing with element's focus. They are:

.focus(handler) - to set focus to a field
.blur(handler) - to get focus from a field

jQuery - Change CSS Style

As you can see in our previous articles for jQuery tips and tricks, this Javascript library can finish almost all we want to do.

We can get DOM nodes, access and change their values, create or remove elements on the fly... And now we'll provide a simple way for changing CSS style of an element.