• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to implement keyup function in codeiginter?

#1
[eluser]RalphLeMouf[/eluser]
I am currently building the section of my site where the user edits their profile. In each category, where they fill out their info, there is a textarea that has the number of characters they are allowed to type. I am trying to get the numbers to countdown as they type. Basic key up. How and what, is the best way to integrate this feature in code igniter? Are there helpers that code igniter provides for this? I am new to this all together.

Here is the code I'm trying to apply this to:

Code:
<div class="edit_section_title">
  
   My Life <br /><span class="edit_section_sub">Tell us a about yourself <span class="edit_sub_text">(1350 character limit)</span>
  </div>
  <div class="edit_text_area">
  
  &lt;?php
  if(empty($user['mylife']))
  {
   echo form_textarea('mylife');
  }
  else
  {
   echo form_textarea('mylife', $user['mylife']);
  }
  
  
  ?&gt;
  
  </div>
  <div class="edit_section_title">
   Occupation <br /><span class="edit_sub_text">(200 character limit)
  </div>
  <div class="edit_input_area">
   &lt;?php
  
   if(empty($user['occupation']))
   {
    echo form_textarea('occupation');
   }
   else
   {
    echo form_textarea('occupation', $user['occupation']);
   }
  
   ?&gt;
  </div>

thanks in advance

#2
[eluser]solid9[/eluser]
I think you need JavaScript.

#3
[eluser]RalphLeMouf[/eluser]
well, yeah. That's why I mentioned the "key up"

#4
[eluser]PhilTem[/eluser]
There are two very good ways:

1) Add the javascript markup before the textarea in the view code
2) Have a ./assets/scripts/app.js file where you put all your javascript markups and include it in your template header


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.