Skip to content
No description, website, or topics provided.
HTML JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information. Update Jan 14, 2019
Insert contact data on page 1.html Add files via upload May 11, 2018 Update Sep 25, 2019
anonymous-random-email-address.html Update anonymous-random-email-address.html Jan 7, 2019
change-error-text-for-a-single-field.html Create change-error-text-for-a-single-field.html May 3, 2018
direct-debits-next-month-20th.html Create direct-debits-next-month-20th.html Apr 19, 2018
direct-debits-next-two-possible-dates.html Update direct-debits-next-two-possible-dates.html Jul 15, 2019
ett-target-block-show-target-party.js Create ett-target-block-show-target-party.js Mar 12, 2018
field-masks.html Update field-masks.html May 3, 2018
max-number-of-characters-in-target-block.html Create max-number-of-characters-in-target-block.html Oct 23, 2018
opt-in-text-toggle.html Update opt-in-text-toggle.html Feb 27, 2018
placeholders.html Update placeholders.html Jan 3, 2019
pre-tick-and-hide-opt-in.html Update Sep 2, 2019 Update Sep 3, 2018 Update May 14, 2019
textarea-characters-remaining.html Create textarea-characters-remaining.html May 3, 2018
tls-checker.html Update tls-checker.html Apr 30, 2018
update-field-with-another-field's-value.html Update update-field-with-another-field's-value.html Jun 27, 2018

page-builder: Code Blocks

Code Blocks can contain styles and javascript that only run when you preview or load the live page. They can add extra functionality to your pages.

Note that these need to be thoroughly tested by you before launching your page! It is functionality outside of the normal operation of the platform.

Many of these code blocks assume you have the jQuery library loaded in your template. If you do not, then you can add it via a line in your template's <head>, e.g.:

<script src=""></script>

Where to put the code block

The code block's position is important - if it is responding to a part of the page but it loads before it, it may not work. It is good to position the block at the bottom of your pages. Sometimes, you may want to wrap the code up in a ready event - this is so that it will only fire once the page has fully loaded:

$( document ).ready(function() {
    // your code here

Fields code

Add placeholders within text boxes that match the input's label

Do not allow spaces in an email address field

Create and place a random email address - useful for anonymous actions

Disable the submit button until the supporter presses a key inside the email-to-target message (to force them to edit it)

Field masks, e.g. for phone numbers or credit card numbers

Change the error text for a specific field

Counters for characters remaining in textareas

Update a field with another's contents's-value.html

Locale - save to a question/field when you submit the page

Target block messages to have a maximum number of allowed characters

Searchable select field

Opt-in code

Show and hide an alert if the supporter chooses No for a radio opt-in

Pre-tick and hide a checkbox or radio opt-in

Donation pages code

Choose the next two available start dates on the 1st of the month

Choose the next two available start dates on the 1st or 15th of the month

Choose the next available start date as the 20th of next month

Gift aid calculation display in a text block

Verify account number and sort code for thanks emails

Social code

Change the share icons' simple images to your own images

Add a Whatsapp sharing button for mobiles

Add a share by email button


Add a more info link that expands to reveal more content

Add a fixed floating button to allow supporters to scroll down to the form for narrow screens/mobiles

Alert supporters if their browser does not support TLS 1.1 or above (see for more information)

Show the supporter's MP name on a non-email-to-target page

You can’t perform that action at this time.