JQuery val() quirk

I’ve had a good solid day of coding, probably my first in quite a while. Whilst I was playing round some JQuery I came across a quirk I’ve never noticed before. I call it a quick because it’s certainly not behaviour I’d expect.

When working with some HTML form elements I used the JQuery method val() to set the value of a select box. So as an example here’s a select box and the JQuery to set it.


<select name="DavesSelectBox" id="DavesSelectBox">
<option value="0">Zero</option>
<option value="1">One</option>
</select<


$(DavesSelectBox).val(1);

Now the problem arises when the form is submitted using a normal submit button and post method. I noticed whilst it visually seemed the select box was being set to the value, the posted value didn’t reflect this and posted the original value.

So after some looking around it turns out that if the element has the same name and id then .val() can sometimes be a little problematic. So the quick fix to change the name and id to different values. Strange!

Search Analysis with Google Analytics

I nearly forgot about linking to this, my first article for a while.

For those who may have noticed I’ve been doing a few Google Analytics articles for Six Revisions and the latest published a few weeks ago looks at the basics of tracking searches on your site and what you can start to glean from the information available in Google Analytics. Click on the image to go and read the article.

CSS hover tabs realigned.

This was requested on the original CSS hover tabs post and as usual it has taken me ages to get around to doing it.

Anyway it is just the previous version realigned and also with an added tab to show you how easy it is to customise and add extra tabs.

You can view the demo here, it’s pretty straight forward and I won’t go into detail as it is all worked using the same principles as the original post so read that first and then take a look at the source of this one. It’ll do you good to do some thinking and look at what’s changed!

CSS Fundamentals: CSS 3 Transitions

Being rather busy I completely forgot to post the link to this last week, but I wrote an article for the great tutorial site NetTuts about CSS3 transitions.

It is a introduction for those who haven’t used the transitions before and goes on to a little more advanced usage within CSS3 animations – so go check it out at http://net.tutsplus.com/tutorials/html-css-techniques/css-fundametals-css-3-transitions/


5 resolutions you should make this year

Well I started this post knowing full well there’d be plenty of resolution posts around as we enter this new year, and having not got this finished quickly, there are plenty around. You can’t really make anyone follow a resolution and you should all take up your own but here’s five suggestions from me, if you have room in your life for 12 then head over to Six Revisions and have a read of A Designer’s List of New Year’s Resolutions.
Continue reading