Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Function textbox Counter and other operations

$
0
0

Hello,

I have a question: I create a function to count the number of caracters of a textbox. To report the number of caracters you have avaliable. When I load the screen works. But when I click a button to clean the screen the function doesn't work anymore. Another case is when I use a function with dialog to open a screen that uses the same function. It does not work.

Follow the code in Java

            $('<%[textbox].ClientId%>').keypress(function () {
                contFunction()
            });

           function contFunction() {
            var maxlimit = 949;
            var label = document.getElementById('<%=[label].ClientID %>');
            var textbox = document.getElementById('<%=[textbox].ClientID %>');
             if (textbox.value.length > maxlimit)
                 textbox.value = textbox.value.substring(0, maxlimit);
             else
                 label.innerText = (maxlimit - textbox.value.length);
        }

Anybody has a idea what I did wrong?

Thanks, for the attention.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>