Defensive programming with jQuery
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 [...]
Re-using server side logic for client side validation
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.
Deselecting options from a select element in jQuery
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 [...]
Changing javascript event attribute on the fly
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 [...]
How short can you code
Still on cloud number 9 with jQuery, I thought of a new slogan for it:
jQuery – how short can you code?
jQuery basics
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 [...]
I heart jQuery
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, [...]
Recent Comments