Robert Kent


Personal blog of Robert Kent

Drupal 7: Adding autocomplete to search fields

In many cases when you have a search field it can be useful to provide a list of suggestions to the user as they type. This small interaction provides several benefits to the user: It affirms to the user that the site search is working It provides potential searches an alternatives to the user before they even complete a search … Read More


Tiered Checkboxes

I was working on an admin area for a site that had checkboxes next to headings and subheadings. This script allows for a parent checkbox to be checked when you select one of its children.

To automatically open tiers on load if a checkbox is checked use


Simple JavaScript Templating

You should avoid writing HTML in Javascript code because it can be difficult to modify and maintain. For example, this can get messy, unwieldy and very easy to accidentally cause syntax errors:

Instead, consider using a template. HTML template Write your HTML template in a <script> tag with the type set to text/template. This prevents the browser from rendering or attempting to … Read More