Cakephp Classroom image

Anil  Bist / Professional / Web Technology

 
To post your Question Join Classroom
 
Question No  (4 of 18)
First 1 I 2 I 3 I 4 I 5 I 6 I 7 I 8 I 9 Last
 
Question:-

How to count character of inut type text and textarea ?

 
Answer:-

It will count character when you press key, i have called onkeyup javascript function  

Jquery help

we can do this with jquery 

check this 

<div class="form-group">
                <label>Page Title:(60 WORDS)</label>
                <?php echo $this->Form->textarea('page_title', array("onkeyup"=>"countChar1(this)","cols" => "40", "maxlength" => "60","class"=>"form-control")); ?>
                <div id="charNum1"></div>
            </div>

 

<script>
    function countChar1(val) {
        var len = val.value.length;
        if (len >= 60) {
            val.value = val.value.substring(0, 60);
        } else {
            $('#charNum1').text(60 - len);
        }
    }

</script>

  
 
 
 
image
Anil  Bist

Skills    Cakephp

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (5)

Ask 
image
Rohin
Ask 
Sanjay
Ask 
Riya
Ask 
image
deepu
Ask 
image
divya
 
 

Recommended Classes

image Anil Bist
I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore an...
Professional
image shweta Pandey
Passionate about LIFE and Learning. Lets explore together better version of "self", &qu...
Professional
image shweta Pandey
Passionate about LIFE and Learning. Lets explore together better version of "self", &qu...
Professional