Posts Tagged ‘jquery’

Bug or Stupidity?: jQuery, Imagemaps, and Dynamically Inserting Area Tags

Wednesday, November 12th, 2008

I’ve run across something that is not making any sense to me.

The situation: I’ve got an empty imagemap that I want to dynamically enter area tags into with jQuery. I’ve been trying to insert them using .append() or even .html() and every time I attempt to do so nothing occurs. I can insert text or other tags, but no actual area tags.

Now, if I go oldschool and use document.getElementById(insertnamehere).innerHTML = “inserttagshere” that works. But every variation I can think of to use jQuery methods to add an area tag fails.

Can anyone think of anything obvious that I’m missing here?

jQuery, JSON and IE - Getting Incorrect Array Length

Tuesday, October 14th, 2008

Has anyone had the following problem? When loading a JSON array (through something like $.getJSON), Internet Explorer will sometimes report the length of the array being one higher than other browsers, with the extra element in the array being blank.

I don’t know if this is a problem in other libraries, but I suspect it is. But I do know that it’s happened to me when using jQuery’s Ajax functions.

Why is this occurring?

I was tormenting myself with this same question on a client project, and discovered that although a bit of browser quirkiness was involved, it was actually an error on my part.

I hate it when it’s me. ;)

(more…)