-1

i want do the follow in js. Someone know how to do this?

http://s7.directupload.net/file/d/3361/587yctzg_jpg.htm

Here a start: http://jsfiddle.net/HgfPU/10/

    <textarea></textarea>

    <strong>You have <em id="count"></em> characters remaining</strong>

    <script>

    maxCharacters = 160;

    $('#count').text(maxCharacters);

$('textarea').bind('keyup keydown', function() {
    var count = $('#count');
    var characters = $(this).val().length;

    if (characters > maxCharacters) {
        count.addClass('over');
    } else {
        count.removeClass('over');
    }

    count.text(maxCharacters - characters);
});

</script>

Thank you!

Update

Found a solution here:

http://jsfiddle.net/X7d8H/23/

Nepo Znat
  • 3,000
  • 5
  • 28
  • 49

1 Answers1

0

Using a regular text-field, there's no way you can apply style to text.

You may want to use selection to mark text which is invalid, or use a Rich Text Editor, but it's using something huge for a very small need.

blue112
  • 52,634
  • 3
  • 45
  • 54