Šime, $('title').html() works fine in both IE8 and FF, fixing my problem.
But I don't understand why the difference in behaviour on <title>: surely if there's only one title element than the innerHTML of the first matched element should be the same as the concatenated innerHTML of all matched elements? But if I try to print $('title').text() in IE8, it prints an empty string.
In any case, you fixed my problem for me so thanks a lot! Graham Šime Vidas wrote:
The, html() method works in all browsers... text() = returns the concatenated innerHTML properties of all matched elements html() = returns the innerHTML property of the first matched element Generally you don't use text() to retreive the contents of an element... BUT, if you want to write to the innerHTML property, then ... html("blablabla") = sets the innerHTML property to the given string on every matched element text("blablabla") = sets the innerHTML property to the given string on every matched element, AND escapes < and >