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

  • SEARCH
  • Home
  • 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 9088753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:58:29+00:00 2026-06-16T21:58:29+00:00

am a newbie with jquery .. i have this html code <div id=’input’> <table>

  • 0

am a newbie with jquery .. i have this html code

<div id='input'>
<table>
    <tr>
    <td class="number">
    <input><input><input><input><br>
    </td>
    <td style="vertical-align:bottom"><button>+</button></td>
    </tr>
    <tr>
    <td class="number">
    <input><input><input><input><br>
    </td>
    <td style="vertical-align:bottom"><button>+</button></td>
    </tr>
</table>
</div>

and for my script part

jQuery.fn.vcenter = function(parent) {
    if (parent) {
        parent = this.parent();
    } else {
        parent = window;
    }
    this.css({
        "position": "absolute",
        "left": ((($(parent).width() - this.outerWidth()) / 2) + $(parent).scrollLeft() + "px"),
    });
return this;
}
jQuery.fn.hcenter = function(parent) {
    if (parent) {
        parent = this.parent();
    } else {
        parent = window;
    }
    this.css({
        "position": "absolute",
        "top": ((($(parent).height() - this.outerHeight()) / 2) + $(parent).scrollTop() + "px"),
    });
return this;
}
jQuery.fn.center = function(parent) {
    if (parent) {
        parent = this.parent();
    } else {
        parent = window;
    }
    this.css({
        "position": "absolute",
        "top": ((($(parent).height() - this.outerHeight()) / 2) + $(parent).scrollTop() + "px"),
        "left": ((($(parent).width() - this.outerWidth()) / 2) + $(parent).scrollLeft() + "px"),
    });
return this;
}
$(document).ready(function(){
$("#input").vcenter(true);
});
$("#input:button").click(this.parent().prev().html()+="<input><input><input><input><br>");

what am trying to do basically is each time i click on a button inside the element that has the id “input”
the script executes the following : the script goes to the parent element (the ) then the previous sibling ! then add to its html inner the following : "<input><input><input><input><br>"
i have done my homework ! and i need help ! what’s wrong here ?

  • 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-06-16T21:58:31+00:00Added an answer on June 16, 2026 at 9:58 pm

    The .click() handler takes a function as its parameter.

    So

    $("#input button").click(this.parent().prev().html()+="<input><input><input><input><br>");
    

    would become

    $("#input button").click(function(event) {
        var old_html = $(this).parent().prev().html();
        $(this).parent().prev().html(old_html+"<input><input><input><input><br>");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need help with this JQuery code i have.. i'm still a newbie when
I'm a jQuery newbie. I've something like the following HTML: <div class=dcsns-youtube> <span class=section-thumb>
I am newbie to jQuery. In netbeans I have jquery-1.7.2.js where all HTML files
I'm a jQuery newbie as of this morning, and this is the code I've
I am newbie to jQuery, can someone explain what this code does: $(#currency form).submit(function(e)
I am a newbie and I have inherited some nasty jquery code. I am
Hello am a newbie in jquery. I have a voting system in wordpress this
I'm a newbie to jquery, but have managed to make a show-function and hover
I'm a jQuery newbie, and I have trouble with a little script I created.
I am a newbie at Javascript and Jquery. I have a form that I

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.