I think it might be that one of them counts \r\n as 1 character and
the other as 2 characters.
To test this, just remove all your newlines and see if the problem
still occurs.
On 30 mei, 08:27, Bob O <sngndn...@gmail.com> wrote:
> I have a pretty simple character counter to count the number of
> character typed by a user..
>
> broadcastSubmit = $('#broadcastSubmitButton');
> broadCastMessageDiv = $('#broadcastMessage');
> availableChars = 140;
> charCount = $('.char_count');
> boilerPlateKeyword = $('#boiler_plate_keyword');
> boilerPlateKeyword.text(keyword.toUpperCase());
>
> broadCastMessageDiv.bind('keyup', function() {
> broadCastDiv = $(this).val();
> previewContentWindowTextLength = broadCastDiv.length;
> boilerPlateText = $('#boiler_plate').val();
> boilerPlateTextLength = boilerPlateText.length;
> charCount.text(availableChars - (boilerPlateTextLength +
> previewContentWindowTextLength) - 0);
> });
>
> This basically has a div with some preset text. (reply stop keyword to
> cancel.)
> and then a textarea that a user types an SMS message into. it combines
> the user input with the preset text and subtracts it from the total
> character limit (140)
>
> my problem is IE is correct in the count, but FF and Safari are equal,
> but wrong. they are showing more characters than there should be.
>
> e.g. after typing in a message IE might be 28 available chars and
> Safari and FF would be 20
>
> Why would those browsers add more to the count? any ideas.
No comments:
Post a Comment