<?xml version="1.0" encoding="utf-8"?>

			<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">

			<channel>
			<title>Blog of Shaun McCran - Architecting robust, elegant technical and business solutions - JQuery</title>
			<link>http://www.mccran.co.uk/index.cfm</link>
			<description>I write about Architecture and Design, Architectural patterns, Architectural Principles and Architectural policies. This includes TOGAF, Zachman, Business Architecture, SOA and Process and tools such as the IBM Rational software and Adobe products. I also write about my previous life as a mobile and web developer.</description>
			<language>en-gb</language>
			<pubDate>Tue, 09 Jun 2026 06:51:38 -0000</pubDate>
			<lastBuildDate>Mon, 15 Jul 2013 06:10:00 -0000</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>shaun@mccran.co.uk</managingEditor>
			<webMaster>shaun@mccran.co.uk</webMaster>
			<itunes:subtitle></itunes:subtitle>
			<itunes:summary></itunes:summary>
			<itunes:category text="Technology" />
			<itunes:category text="Technology">
				<itunes:category text="Podcasting" />
			</itunes:category>
			<itunes:category text="Technology">
				<itunes:category text="Tech News" />
			</itunes:category>
			<itunes:keywords></itunes:keywords>
			<itunes:author></itunes:author>
			<itunes:owner>
				<itunes:email>shaun@mccran.co.uk</itunes:email>
				<itunes:name></itunes:name>
			</itunes:owner>
			
			<itunes:explicit>no</itunes:explicit>
			
			
			
			
			
			<item>
				<title>Stopping form submissions containing HTML code</title>
				<link>http://www.mccran.co.uk/index.cfm/2013/7/15/Stopping-form-submissions-containing-HTML-code</link>
				<description>
				
				Are you getting web form spam? I was, mainly from bots, or &apos;copy and paste&apos; farms where users sit and paste bulk code into your forms. Mostly these contain links or image tags. Rather than compromise the form usability for genuine users I decided to fix my spam issue with a little more tact than you may usually find, such as in the case of Captcha devices.
&lt;p&gt;
I&apos;m already cleaning html code submissions on the server side but why not make things even more informative for my users and tell them up front that their HTML isn&apos;t appreciated.
&lt;p&gt;
I didn&apos;t want a complicated Regex or pattern matching plugin, I simply wanted to detect key HTML elements and tell the user that it wasn&apos;t going to be accepted by the form.
This code uses the JQuery plugin for form validation. You can get it here:
&lt;p&gt;
&lt;a href=&quot;http://jqueryvalidation.org/&quot; target=&quot;_blank&quot;&gt;http://jqueryvalidation.org/&lt;/a&gt;
&lt;p&gt;
First things first, let&apos;s create a custom validation rule to detect our html elements.
&lt;p&gt;
&lt;code&gt;
&lt;s/cript language=&quot;javascript&quot;&gt;
$(document).ready(function(){

    $.validator.addMethod(&quot;findhtml&quot;, function(value, element) {

        var commentclean = true,
            disallowed = [&apos;&lt;&apos;, &apos;http&apos;];

        for (var i=0, len = disallowed.length; i&lt;len; i++) {
            if (element.value.indexOf(disallowed[i]) != -1) {
                commentclean = false;
                break;
            }        
        }

        return this.optional(element) || ( commentclean );

    }, &quot;* match the string&quot;);

});	
&lt;/s/cript&gt;
&lt;/code&gt;
&lt;p&gt;
This creates an array of disallowed elements and loops through them when the rule is invoked.
&lt;p&gt;
Secondly we will use this rule in our validation routine when a user tries to submit the form.
&lt;p&gt;
&lt;code&gt;
	&lt;!--- Form now powered from JQuery  ---&gt;
	&lt;s/cript type=&quot;text/javascript&quot;&gt;
		$(document).ready(function(){
			$(&quot;#form&quot;).validate({
			
			rules: { 
				name: {required: true},
				email: {required: true},
				tel: {required: false},
				message: {required: true, findhtml: true}
			 },

			messages: {name: &quot;Please enter your Name&quot;,
				email: &quot;Please enter a valid email address&quot;,
				tel: &quot;&quot;,
				message: {required: &quot;Please enter a message&quot;, findhtml: &quot;You cannot enter HTML in this field&quot;}
			  }
			
			});
		});
	&lt;/s/cript&gt;
&lt;/code&gt;
The key line here is:
&lt;code&gt;
message: {required: true, findhtml: true}
&lt;/code&gt;
&lt;p&gt;
This invokes our previously created validation rule.
&lt;p&gt;
In this way the user is told &apos;You cannot enter HTML in this field&apos;. A friendly validation message that clearly shows WHY the form isn&apos;t going to work.
&lt;p&gt;
You can see this working on my contact form here : &lt;a href=&quot;http://www.mccran.co.uk/contact/&quot;&gt;http://www.mccran.co.uk/contact/&lt;/a&gt;
				
				</description>
				
				
				<category>JQuery</category>
				
				<category>Javascript</category>
				
				<pubDate>Mon, 15 Jul 2013 06:10:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2013/7/15/Stopping-form-submissions-containing-HTML-code</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Using JQuery to check Radio button selections</title>
				<link>http://www.mccran.co.uk/index.cfm/2012/2/13/Using-JQuery-to-check-Radio-button-selections</link>
				<description>
				
				Ever wanted to check if a user has checked at least one option from a series of radio fields? JQuery makes this super simple, here&apos;s how to do it:
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<pubDate>Mon, 13 Feb 2012 03:03:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2012/2/13/Using-JQuery-to-check-Radio-button-selections</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>JQuery Countdown timer Plugin example</title>
				<link>http://www.mccran.co.uk/index.cfm/2012/2/9/JQuery-Countdown-timer-Plugin-example</link>
				<description>
				
				I&apos;d previously used a JavaScript script to count down from a now() to a given date to display real time count down information on screen. I was cleaning up the project it was used on and wondered how easy it would be to push all the &apos;normal&apos; JavaScript into a JQuery plugin and encapsulate it all into one function call.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>Javascript</category>
				
				<pubDate>Thu, 09 Feb 2012 07:54:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2012/2/9/JQuery-Countdown-timer-Plugin-example</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>JQuery auto resize input field Plugin example</title>
				<link>http://www.mccran.co.uk/index.cfm/2012/2/6/JQuery-auto-resize-input-field-Plugin-example</link>
				<description>
				
				I was looking for a simple way to make an existing Text Area form field expand as-and-when a user fills in enough information to reach to bottom edge of the form element.

James Padolsey has written a great little Auto resize function, you can get it from Github here: &lt;a href=&quot;https://github.com/padolsey/jQuery.fn.autoResize&quot; target=&quot;_blank&quot;&gt;https://github.com/padolsey/jQuery.fn.autoResize&lt;/a&gt;. 

The documentation in the example included with the download above is pretty good, but I&apos;ve put up an example of it working here as well:

&lt;a href=&quot;http://www.mccran.co.uk/examples/text-area-expander/&quot; target=&quot;_blank&quot;&gt; JQuery Auto resize Textarea plugin example&lt;/a&gt;
				
				</description>
				
				
				<category>JQuery</category>
				
				<category>RIA</category>
				
				<pubDate>Mon, 06 Feb 2012 07:13:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2012/2/6/JQuery-auto-resize-input-field-Plugin-example</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Forcing the dollar ($) Namespace within your JQuery functions</title>
				<link>http://www.mccran.co.uk/index.cfm/2012/2/6/Forcing-the-dollar--Namespace-within-your-JQuery-functions</link>
				<description>
				
				Whilst documenting some Open Source platforms for an upcoming project I found that several of the larger more prominent Open Source software solutions perform some subtle tweaks to included JavaScript libraries. In this case JQuery.

This is a short post on ho to ensure that the $ character always represents the JQuery library in your framework.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>Javascript</category>
				
				<pubDate>Mon, 06 Feb 2012 03:57:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2012/2/6/Forcing-the-dollar--Namespace-within-your-JQuery-functions</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Dynamically tagging content with Keywords using JQuery</title>
				<link>http://www.mccran.co.uk/index.cfm/2012/2/1/Dynamically-tagging-content-with-Keywords-using-JQuery</link>
				<description>
				
				I&apos;ve used a ticketing system called Lighthouse App for a while now, and one of the features I really like about it is its ability to tag content with keywords in a very easy and obvious fashion.

If you have ever wanted to tag an article or some content with a list of Keywords then this blog article is for you.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>Javascript</category>
				
				<category>RIA</category>
				
				<pubDate>Wed, 01 Feb 2012 08:22:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2012/2/1/Dynamically-tagging-content-with-Keywords-using-JQuery</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Simple JQuery Google Analytics tracking object</title>
				<link>http://www.mccran.co.uk/index.cfm/2012/1/11/Simple-JQuery-Google-Analytics-tracking-object</link>
				<description>
				
				Each time I build a new project I find myself adding in several common objects from a variety of languages. One of those objects is a JavaScript based Google Analytics tracking object.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>Google</category>
				
				<category>Javascript</category>
				
				<pubDate>Wed, 11 Jan 2012 09:07:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2012/1/11/Simple-JQuery-Google-Analytics-tracking-object</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Book review: JQuery Mobile – a first look</title>
				<link>http://www.mccran.co.uk/index.cfm/2012/1/5/Book-review-JQuery-Mobile--a-first-look</link>
				<description>
				
				I was recently sent a copy of JQuery Mobile by Packt publishing for review. I&apos;ve dabbled in the JQuery Mobile development language a fair amount, so I was interested to see what this book could teach me that may be different from the information out there in the community.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>Internet Explorer</category>
				
				<category>Mobile</category>
				
				<category>Javascript</category>
				
				<pubDate>Thu, 05 Jan 2012 03:31:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2012/1/5/Book-review-JQuery-Mobile--a-first-look</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>FancyBox JQuery plugin reborn as FancyApps</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/12/14/FancyBox-JQuery-plugin-reborn-as-FancyApps</link>
				<description>
				
				I&apos;m a big fan of the fancybox plugin. It is a very flexible JQuery lightbox plugin that has met every project requirement I&apos;ve ever needed a lightbox for. It also has a great library of events attached to it that have fit most of the User Interfaces I&apos;ve ever used it in.

The fancybox plugin has matured into version 2 and been re-badged slightly as part of the fancyApps suite.

It has to be one of my top ten recommended JQuery plugins.

&lt;a href=&quot;http://fancyapps.com/fancybox/&quot; target=&quot;_blank&quot;&gt;http://fancyapps.com/fancybox/&lt;/a&gt;

&lt;h3&gt;Licensing changes&lt;/h3&gt;
I&apos;ve since found that the new version of fancybox (2) has had a license change. Version 1 is licensed under both MIT and GPL licenses (&lt;a href=&quot;http://docs.jquery.com/Licensing&quot; target=&quot;_blank&quot;&gt;http://docs.jquery.com/Licensing&lt;/a&gt;) but version 2 is &apos;&lt;a href=&quot;http://fancyapps.com/fancybox/#license&quot; target=&quot;_blank&quot;&gt;Creative Commons Attribution-NonCommercial 3.0&apos;&lt;/a&gt; and requires an $89.00 fee for commercial use, as discussed here in a Google Group: &lt;a href=&quot;http://groups.google.com/group/fancybox/browse_thread/thread/fc4467bf0bf3ef6d/3edff176327fed35?lnk=gst&amp;q=license#3edff176327fed35&quot; target=&quot;_blank&quot;&gt;http://groups.google.com/group/fancybox/browse_thread/thread/fc4467bf0bf3ef6d/3edff176327fed35?lnk=gst&amp;q=license#3edff176327fed35&lt;/a&gt;
				
				</description>
				
				
				<category>JQuery</category>
				
				<category>Javascript</category>
				
				<pubDate>Wed, 14 Dec 2011 07:29:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/12/14/FancyBox-JQuery-plugin-reborn-as-FancyApps</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Using URL hashes to control AJAX requests</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/10/20/Using-URL-hashes-to-control-AJAX-requests</link>
				<description>
				
				Following on from my previous article here (&lt;a href=&quot;http://www.mccran.co.uk/index.cfm/2011/10/17/Adding-hash-values-into-URLs--The-basics&quot; target=&quot;_blank&quot;&gt;http://www.mccran.co.uk/index.cfm/2011/10/17/Adding-hash-values-into-URLs--The-basics&lt;/a&gt;) this article deals with injecting Hash values into URL&apos;s and using them to power AJAX requests.

Starting with the code of the previous article I&apos;ll expand it to include an AJAX request based on the Hash inserted into the URL.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>Javascript</category>
				
				<category>AJAX</category>
				
				<pubDate>Thu, 20 Oct 2011 13:53:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/10/20/Using-URL-hashes-to-control-AJAX-requests</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Adding hash values into URLs - The basics</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/10/17/Adding-hash-values-into-URLs--The-basics</link>
				<description>
				
				Building a site that uses AJAX to Asynchronously import content into it? You can take advantage of the URL hash value and some of the functionality it gives you. 

By inserting a hash character into the URL you can pick up the string following it and use it as a value in AJAX requests. Also you can create a listener event to check for a hash being added to a URL and use that to activate your custom JavaScript.

This blog entry is an intro to this process, where we deal with adding the hash value into a URL.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>Javascript</category>
				
				<category>AJAX</category>
				
				<pubDate>Mon, 17 Oct 2011 15:26:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/10/17/Adding-hash-values-into-URLs--The-basics</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Using JQuery to dynamically add form fields to a page</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/8/18/Using-JQuery-to-dynamically-add-form-fields-to-a-page</link>
				<description>
				
				I&apos;d seen a few different ways of dynamically adding form fields to a web page but hadn&apos;t ever tried it. I was interested in seeing how exactly you can do this at a technical level, but also how you can manage the users interactions, allowing them to keep adding fields as they complete the previously added ones.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>Javascript</category>
				
				<pubDate>Thu, 18 Aug 2011 14:51:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/8/18/Using-JQuery-to-dynamically-add-form-fields-to-a-page</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Super small JQuery / JavaScript image mouseover script</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/8/16/Super-small-JQuery--JavaScript-image-mouseover-script</link>
				<description>
				
				I&apos;ve been developing more and more rich content using JQuery / JavaScript and today I spent a little time researching and putting together an image mouseover script.

Sure, there are loads of them already, but I really wanted to see how compact and efficient I could get this simple bit of functionality.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>Javascript</category>
				
				<pubDate>Tue, 16 Aug 2011 14:23:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/8/16/Super-small-JQuery--JavaScript-image-mouseover-script</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Simple JQuery way to detect links pointing to external domains</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/7/27/Simple-JQuery-way-to-detect-links-pointing-to-external-domains</link>
				<description>
				
				Ever wanted to detect links on your site that point to other domains? A few times in the past I&apos;ve had requests to be able to pick out all the hyperlinks from a site that move a user to a different domain.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>Javascript</category>
				
				<pubDate>Wed, 27 Jul 2011 14:11:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/7/27/Simple-JQuery-way-to-detect-links-pointing-to-external-domains</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Book review: jQuery 1.4 Animation Techniques: Beginners Guide</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/6/21/Book-review-jQuery-14-Animation-Techniques-Beginners-Guide</link>
				<description>
				
				This is a review of a book that Packt Publishing (&lt;a href=&quot;http://www.packtpub.com/&quot; target=&quot;_blank&quot;&gt;http://www.packtpub.com/&lt;/a&gt;) have just sent me: JQuery titles, jQuery 1.4 Animation Techniques: Beginners Guide.
&lt;p&gt;
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>Social media</category>
				
				<category>Javascript</category>
				
				<pubDate>Tue, 21 Jun 2011 03:23:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/6/21/Book-review-jQuery-14-Animation-Techniques-Beginners-Guide</guid>
				
				
			</item>
			
		 	
			</channel></rss>