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 7704587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:42:50+00:00 2026-05-31T23:42:50+00:00

I have form like this : <div id=’add_field’ class=’locbutton’><a href=’#’ title=’Add’>Add</a></div> <div id=’remove_field’ class=’locbutton2′><a

  • 0

I have form like this :

<div id='add_field' class='locbutton'><a href='#' title='Add'>Add</a></div>
<div id='remove_field' class='locbutton2'><a href='#' title='Delete'>Delete</a></div>
<div id='idisikpi'>
<div id='idheadisi1' class='headisi'>
<div class='performancedetail'><input type='text' name='idperformancedetail[1][]' 
value='2' id='idperformancedetail[1][]'></div>
<div class='performancedetail'><input type='text' name='idperformancedetail[2][]' 
value='9' id='idperformancedetail[2][]'></div>
</div>
 </div>

This is the jquery script :

function CreateInput()
{

    var $headisi = $("<div>"),
    $idperformancedetail=$("<div>");

  var headisi_count = $("div.headisi").length+1;
  var idperformancedetail_count = 
  $("[id^='idperformancedetail']").last().val().length+1;

  $headisi.addClass("headisi");
  $idperformancedetail.addClass("performancedetail");

  var $input_idperformancedetail = $("<input>")

  $input_idperformancedetail
    .attr("name", "idperformancedetail["+headisi_count+"][]")
    .attr("type", "text")
    .attr("id", "idperformancedetail["+headisi_count+"][]")
    .attr("value", idperformancedetail_count);
  $idperformancedetail.append($input_idperformancedetail);

    $headisi.append($idperformancedetail);

  return $headisi;
}



$("#add_field a").click(function(e)
{
$("#idisikpi").append(CreateInput());

e.preventDefault();
});

$("#remove_field a").click(function(e){
$("#idisikpi div.headisi:last-child").remove();
CalculateTotal();

e.preventDefault();
});

I want the next input is counter from last value of idperformancedetail, i want value on the next input like 10,11,12,…What can i do to get counter value on the next input ? Please Help me 🙁

  • 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-31T23:42:52+00:00Added an answer on May 31, 2026 at 11:42 pm

    You have to parse $("[id^='idperformancedetail']").last().val() as an integer (parseInt), otherwise you’ll get a concatenated string. Also you don’t want to use .length, but val():

    var idperformancedetail_count = parseInt($("[id^='idperformancedetail']").last().val()) + 1;
    

    JSFiddle demonstration. Note that val() will only work since you set the value attribute in the div yourself. This will completely ignore your input‘s value.

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

Sidebar

Related Questions

I have a form that looks kind of like this: <div> <div class=contact> <h1>Person's
i have a repeating form like this: <ui:repeat var=blogPost value=#{blogPosts}> <h:form> <div class=full> <label
I have a form, like this <form id=picuploadform enctype=multipart/form-data method=post action=> <div class=row> <label
I have form like this: <div class=satu> <input type='text' size='1' maxlength='1' name='score[1][]' id='score[1][]'> </div>
I have a form that looks like this: class SampleForm(forms.Form): text = forms.CharField(max_length=100) In
Well i have a complex form view model like this : public class TransactionFormViewModel
Currently my AJAX is working like this: index.php <a href='one.php' class='ajax'>One</a> <div id=workspace>workspace</div> one.php
i have a form in JSF2.0 like this <h:form id=validationFrom > <div id=mandotary >
I have a form like this <div data-role=page id=callAjaxPage> <div data-role=header> <h1>Login</h1> </div> <div
Ok: i have a dynamic form like this: <div id=container> <div id=autosuggest>...</div> <form action=

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.