Posted on 3 Comments

I’m done with document.getElementById

I’m working on a project that has compatibility with Internet Explorer 6 as a major requirement. This means all appearances, all Ajaxy functionality, every aspect of the web application should look and perform in IE6 just as it would in Firefox, Chrome, IE7, IE8, and Safari. One of my favorite pieces of code is "document.getElementById()" but special cases have to be considered for IE 6. As an example, you can use getElementById to change the value of a hidden form element:

<input type="hidden" id="foo" name="foo" value="default value">
<input type="submit" id="goBtn" name="goBtn" value="Process..." onclick="document.getElementById('foo').value='anothervalue';">

That code will not always work. jQuery comes to the rescue! Rather than write lines and lines of additional code for browser testing and coding for a special case, we can simply replace "document.getElementById(‘foo’).value=’anothervalue’;" with "$(‘#foo’).val(‘anothervalue’);" and the code will work.

<input type="hidden" id="foo" name="foo" value="default value">
<input type="submit" id="goBtn" name="goBtn" value="Process..." onclick="$('#foo').val('anothervalue');">

I cannot sing jQuery’s praises enough!

Posted on Leave a comment

Things to add to bids

In today’s economic times, people love to talk about pork in budgets, ridiculous bonus programs, or over the top salaries. Some items are just plain necessary! I think from now on, all my quotes for projects will include a line item for coffee, a line item incense, and a line item for iTunes. That may sound frivolous but if you want me at maximum productivity, I’ve got a keyboard in one hand, a cup o’ Joe in the other, headphones emanating tunage into my ears, and lovely scents wafting all about. That said, I’m burning my last stick of incense right now. I may have to make a foray to World Market, Green Earth Emporium, or Earth to Old City today (well..tomorrow).