|
Rank: Advanced Member Groups: Member
Joined: 11/13/2008 Posts: 43
|
Hi, I'm using the following to display a count of the number of characters in an eo:Editor control:
Code: HTML/ASPX
<eo:Editor runat="server" ID="Q1" Width="500px" Height="100px" FooterVisible="False" HighlightColor="255, 255, 192" ToolBarSet="Custom" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" LineBreakMode="Br" ClientSideOnChange="charCount" FontNames="Arial" PasteFilter="TextWithLineBreak">
Code: JavaScript
function charCount(ed, count)
{
document.getElementById(count).innerText = jQuery.trim(eo_GetObject(ed).getText()).length;
}
This works perfectly in every browser except FireFox. Is this a known issue with FireFox? If so, is there a way round it? Alternatively, is there a better way of displaying a real-time character count of an eo:Editor? Thanks, Mark
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
Your way is correct. But FireFox doesn't support innerText. So you have to use innerHTML instead.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 11/13/2008 Posts: 43
|
Simple as that, eh? :-)
Thanks.
|
|
Rank: Advanced Member Groups: Member
Joined: 11/13/2008 Posts: 43
|
Actually, I found a different and better way which doesn't involve innerText / innerHtml and seems to be completely browser independent:
Code: JavaScript
function charCount(ed, count)
{
var chrCount = document.getElementById(count);
while (chrCount.firstChild !== null) {chrCount.removeChild(chrCount.firstChild); }
chrCount.appendChild(document.createTextNode(jQuery.trim(eo_GetObject(ed).getText()).length));
}
|
|