Hey all,
I'm using jQuery to try and access the contents of an iframe WYSIWYG, just to get the character count and update a counter outside the iFrame. Oddly enough, my code works fine in in Firefox, but breaks in all versions of IE. Wondering if anyone could help me out with some IE-friendly syntax? Here's what I have so far:
This is in the onload function:
textCounterWYSIWYG('longDesc_cnt', 2000);
This is the function itself:
function textCounterWYSIWYG(text, limit) {
var len = String($("iframe").contents().find("body").html());
var trimmed = len.replace(/^\s+|\s+$/g, '');
var length = trimmed.length;
if (length > limit) {
field.value = field.value.substring(0, maxlimit);
}
else {
var rem = limit - length;
$("#"+text).text(rem + " Characters Remaining");
}
}
The var len = ... line is what seems to be breaking IE. Any thoughts/suggestions are highly welcome!