Pass controls as attributes to jquery funtions

Pass controls as attributes to jquery funtions

How can I pass a control as a function attribute? In my case I would like to pass txtDirections and charStatus.

Thanks

  1. $(document).ready( function () {

    $( '.txtDirections' ).keyup( function ()

    {

    var maxLength = 1000;

    var textlength = this .value.length;

    if (textlength >= maxLength) {

    $( '#charStatus' ).html( 'You cannot write more then ' + maxLength + ' characters!' );

    this .value = this .value.substring(0, maxLength);

    e.preventDefault();

    }

    else {

    $( '#charStatus' ).html( 'You have ' + (maxLength - textlength) + ' characters left.' );

    }

    });

    });