views:

63

answers:

0
jQuery('.CommentFormTextarea').focus(function (e) {
    jQuery(e.target).animate({
        height: '7em'
    }, 300, function () {
        jQuery(e.target).nextAll('.CommentFormSubmit:first').show();
    });
    jQuery(e.target).prev('label').hide();
})
.blur(function (e) {
    if (jQuery(e.target).val().length <= 0) {
        jQuery(e.target).animate({
            height: '1em'
        }, 300, function () {
            jQuery(e.target).prev('label').show();
        });
        jQuery('.CommentFormSubmit').hide();
    }
})
.bind('keyup focus blur', function (e) {
    if (jQuery(e.target).val().length == 0) {
        jQuery('.CommentFormSubmit').addClass('cInactive');
        jQuery('.CommentFormSubmit').attr('disabled', 'disabled');
    } else {
        jQuery('.CommentFormSubmit').removeClass('cInactive');
        jQuery('.CommentFormSubmit').removeAttr('disabled');
    }
});

The above code is supposed to bind focus event on textArea, animate it, check a couple of thing, bind blur event and keyup focus and blur events to make val().length tests. The only buggy thing occures on focus : animation goes fine on focus, but, whatever the browser, cursor suddenly disappears. Stranger, it seems you still have focus, otherwise textarea would fold back up.

What's going on? thanks.