Blog

Pre-populating Some Fields

October 28 2008

I’m in the midst of doing a bit of a progressive enhancement upgrade to this site, which essentially means splitting down my stylesheets to typography, layout and colours, then adding a nice layer of css3 goodness.

Anyhoo, part of that exercise involves streamlining my jquery javascript for the pre-population of form fields on this site, so here’s what I’ve put together:

$("form label").each(function(){
		var forminput = "input#" + $(this).attr("for");
		var labelmsg  = $(this).text();
		$(forminput).attr({"value":labelmsg});
		$(this).hide();$(forminput).each(function(){
			$(this).focus(function(){
				$(this).attr({"value":""});
			});
		});
	});

Right, the script looks for <label> fields on the page, then I build a string that lets jquery pick up it’s associated input field. From there the lovely jquery pixies grab each the text of the label, pre-populate the field with that text and finally another function clears the field when you focus on it. It’s nice and low calorie, enjoy.

Self note: need to think about a nice style for the <code> tags…

Minilogue – Animals

October 20 2008

I’m loving this music video that Ljudbilden & Piloten produced for Minilogue’s Animals. Very inspirational, I recommend heading over to the vimeo page and switching on the HD version.

Yeah, I’m not a Microsoft Guy.

October 20 2008

mac and pc

Normally I don’t really care about this kind of thing, but the new mac ads are pretty funny. More so, I think, than the previous adverts as they poke fun at Microsoft’s odd method of trying to change perception through adverts and celebrity endorsements, whilst not actually fixing the product.

Spectacular Spider-man

September 22 2008

So I love the recent Spectacular Spider-man show. Story wise it’s probably the best adaptation of the comics (yup, more so than the movies) and it really is a visual treat, with amazing designs by Sean “Cheeks” Galloway.

But, there’s one thing that lets it down, the colours. For some reason they opted to use this muted palette and very, subtle highlights/shadows. It’s a look that really flattens everything in a scene, it’s kinda off putting.

Sean Galloway Spider-man

What I’d like to see, is more of Galloway’s personal style in the colour design. He’s got this innate sense of colour that means all of his work just pops of the screen of page, look at these for example.

Sean Galloway Spider-man
Sean Galloway Spider-man

I think Galloway’s own sense of colour is a lot more harmonious with his style. I’d love to see that kind of colour design make it to the tv show, wouldn’t you?

Just discovered an unknown competitive streak

About

Photo of James McEwan

Onezom is James McEwan a web designer, developer and illustrator from Edinburgh, Scotland.

I’m contactable via email on or jamesvmcewan on aim or jvmcewan on yim. more…

Download VCard