Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6145269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:46:10+00:00 2026-05-23T18:46:10+00:00

Hi im using codeigniter PHP with jquery javascript function to create a textbox for

  • 0

Hi im using codeigniter PHP with jquery javascript function to create a textbox for time which is formatted.

I want the jquery function to add my textbox to the row of other textboxes instead of adding them to the bottom of the page.

Picture –> https://i.stack.imgur.com/gFO0w.jpg

Here is my php file. It is messy I know but I am new to all of this.

        <script type="text/javascript"> var i = 0; </script> 

<?php
        for ($i=0; $i< 20; $i++)
        {


?>

   <script type="text/javascript">     

         var input = $("<input>", { //this bit will be removed in the form
                name: 'time'+i,
                val: '00:00:00',
                maxlength: '8',
                size: '5'
            });
            i++;
            input.click(function() {

                $(this).prop({
                    selectionStart: 0,
                    selectionEnd: 0
                });

            }).keydown(function() {

                var sel = $(this).prop('selectionStart'),
                    val = $(this).val(),
                    newsel = sel === 2 ? 3: sel;
                    newsel = sel === 5 ? 6: newsel;

                $(this).val(val.substring(0, newsel) + val.substring(newsel + 1))

                .prop({
                    selectionStart: newsel,
                    selectionEnd: newsel
                });
            });

            $('body').append(('#timearea_DIV').html());

         </script>

            <?php
      echo '<div id="timearea"></div> //THIS IS WHERE THE jquery generated textboxes must go!';

    //the event itself
            echo form_input ('event'.$i , set_value ('event'.$i)); 
    //supplies used
            echo form_input ('supplies'.$i, set_value ('supplies'.$i)); 
    //what is the manufacturer
            echo form_input ('manufacturer'.$i, set_value ('manufacturer'.$i));
    //quantity
            echo form_input ('quantity'.$i, set_value ('quantity'.$i));
    //was the event successful?
            echo form_dropdown ('success'.$i, $yesno , set_value ('success'.$i)); 
    //comment if necessary
            echo form_input ('comment'.$i , set_value ('comment'.$i)); 
     echo '<br/>';
    }

        //end of for loop

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:46:11+00:00Added an answer on May 23, 2026 at 6:46 pm

    You are appending it o body!!
    Place an empty div with an id where you want to add this text box.

    Then for that div

    (#divid).html('text box you want to add')
    

    or append to that div

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to pass a php json encoded variable to a jquery function using codeigniter?
Hi again :) I'm using jQuery script to show/hide some content: <script type=text/javascript> $('.toggleButton').click(function()
I'm using JQuery with CodeIgniter PHP to figure make AJAX calls and return data
I'm using CodeIgniter (a PHP framework) to build an app, and I have an
I am developing a website using CodeIgniter and PHP. Some of my friends suggest
I am using CodeIgniter to pass some parameters to my PHP page through $_POST
I'm using CodeIgniter (because it's awesome) and I have something like: <?php echo anchor(/,
I am using codeigniter framework. where should i sanitize PHP input - controller or
I am thinking of using a PHP framework called CodeIgniter . One of the
I've been using CodeIgniter for some time, and I liked it a lot. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.