I just stumbled over a really annoying bug in jQuery 1.4.1. Internet Explorer 7 and 8 didn’t fire any change event on my text boxes. At least till one other change event from a radio button or drop down list was triggered before. Fortunately I wasn’t the first one to discover the bug and John has already commited a bugfix to git. So the problem will be gone with version 1.4.2.

If you don’t want to or can’t wait for the next version, you can easily fix your current jquery.js file. Go to line 2255 and look for the beforeactivate function. The if-clause limits the initial data storage for change events to radio buttons. That’s why the other change events won’t be registered in IE. Remove the if-clause and everything will work again.

beforeactivate: function(e) {
  var elem = e.target;
  jQuery.data(elem, "_change_data", getVal(elem));

Impulse Studio Labs has produced the first cheat sheet I’ve found for the new version of jQuery. It’s printer-friendly, fits on one page, marks all the new or changed functions and I don’t think they missed anything important.

One of the most annoying “features” of the current .Net versions is the automatic generation of the ids for server controls. I’m doing a lot of my work with JavaScript and especially with jQuery, so these unpredictable ids make the selection of elements not only difficult, but also really slow.

Most of the time it’s pretty easy to avoid server controls, but if you want to relay information from the server to the client at startup, you are usually stuck with WebControls like Literals or HTML controls for hidden fields.

At least that was what I thought till I stumbled upon a command to create hidden fields without these horrible long ids in a separate div container right after the form tag:

ClientScript.RegisterHiddenField(string id, string value)

I usually create my fields in Page_Load like this:

using System.Web.UI;
  protected override void Page_Load(){
      ClientScriptManager csm = Page.ClientScript;
      csm.RegisterHiddenField("foo", "1");
      csm.RegisterHiddenField("bar", string.Empty);

This will create the following HTML code:

<form ...>
      <input type="hidden" id="foo" name="foo" value="1" />
      <input type="hidden" id="bar" name="bar" />

Of course you won’t be able to read or manipulate the field later like a WebControl. And you have no control about the final placement on the page either. But that was never my intention and you can do whatever you want with the field in your JavaScript anyway.