16Oct

Defensive programming with jQuery

by felixt Comments (2)

Sometimes it’s good to code defensively and put those extra checks "just in case". This is especially true if your front end code are generated or rendered dynamically.
I have often encountered Javascript code that tries to access certain HTML element that doesn’t exists. Usually this is caused by [...]

Tags:

12Jun

Re-using server side logic for client side validation

by felixt Comments (0)

In this post, I will show an example how to re-use your server side validation code for client side validation. This is achieved by using Ajax call to the server side validation code.

Tags: , , ,

12Nov

Deselecting options from a select element in jQuery

by felixt Comments (0)

Oh boy, yet another IE7 gotcha.
I wrote this piece of jQuery to code to deselect selected option(s) from a select element:
$("[ name = 'selectFieldName' ] option:selected ").attr( ’selected’, ” );
Which works fine in Firefox, but then when the QA tested it, it doesn’t work for him and of course he tested in IE7 (which is [...]

Tags:

01Nov

Changing javascript event attribute on the fly

by felixt Comments (0)

This doesn’t work in IE, in fact this was one of the problems that responsible for my staying late during the production release mentioned on the previous post.
For that particular project, we have a common user interface (UI) for both adding and editing a record. I use jQuery to change the interface depending on the [...]

Tags:

21Sep

How short can you code

by felixt Comments (0)

Still on cloud number 9 with jQuery, I thought of a new slogan for it:
jQuery – how short can you code?

Tags: ,

10Sep

jQuery basics

by felixt Comments (0)

What’s the most mundane and repeated code that you have to write in Javascript?
Most likely it is getting an element by id or getting some elements by name.
Getting element by id Old school:
var theElem = document.getElementById(’theElem’);
jQuery:
var theElem = $(’#theElem’);
That’s basic enough, it’s pretty similar to Prototype. But worth [...]

Tags:

06Sep

I heart jQuery

by felixt Comments (0)

Earlier this year, my manager asked me to research Javascript framework to be used in our applications.
I proposed jQuery since it seems to be getting lots of love around CF community. Another reason (quite selfishly) was: I want to learn another framework and growing my repertoire of skills (if I wanted to play it safe, [...]

Tags: