How to get one form_input to show up in another? |
Hi there,
I am just wondering if there is a way of having a non-usable input section show up what someone is typing in another input? Thanks, Doomie
jQuery is your best friend.
Load the jQuery library in your page's head section. Then, at the bottom of your page (preferrably after the </body> tag): Code: <script> More info: https://api.jquery.com/keyup/
I have been trying to mess around to get this to work. The following 2 lines are the part of the comlpete form that I want it to copy to.
PHP Code: <?php echo form_input(array('id' => 'input1', 'name' => 'name', 'class' => 'form-control'),'' , $js); ?> I have added the code in the above post and added jquery and it just seems to do nothing and I cannot see why.
You didn't describe the value of the $js variable, but in general, jQuery can handle elements by their id or class.
It should work if you do this: PHP Code: <?php echo form_input(array('id' => 'input1', 'name' => 'name', 'class' => 'form-control')); ?> |
Welcome Guest, Not a member yet? Register Sign In |