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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:01:32+00:00 2026-06-02T23:01:32+00:00

I have some input text fields and I assigning id parent_number and row_number dynamically

  • 0

I have some input text fields and I assigning id “parent_number and row_number” dynamically with jQuery to it when press button of addMore.

<input type="text" name="xpath" id="xpath_chield_'+parent_number+'_'+row_number+'" size="50"/>

it’s out put in browser is

<input id="xpath_chield_2_3" type="text" size="50" name="xpath">

This works fine

After deleting one input field I want to update only “parent_number” to -1 from current parent_number of id but not “row_number”

After update it will output in browser will

<input id="xpath_chield_1_3" type="text" size="50" name="xpath">

How can I do it with jQuery?

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-06-02T23:01:33+00:00Added an answer on June 2, 2026 at 11:01 pm

    You could reduce that portion of the ID like this:

    element.id = element.id.replace( /(\d+)_(\d+)/, function(match, n, o ){
      return ( parseInt( n, 10 ) - 1 ) + "_" + o ;
    });
    

    Demo: http://jsbin.com/ifivor/edit#javascript (Console output)

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

Sidebar

Related Questions

I have some input fields like below: <input type=text name=date_1 class=dataList value=2009-12-30 /> <input
So I have some input text fields and a button <input type=text value=a/> <input
i have some input fields <input type=text name=quantity[] class=est_quantity placeholder=quantity/> <input type=text name=quantity[] class=est_quantity
I have some input fields in the following format: <input name='date_of_birth[month]' type='text' /> <input
I have a form with some input fields: Folder Name: <input type=text id=folderName name=folderName
I have some HTML like this: <input type=radio class=MyRadio name=TheName> <label for=TheLabel>the text</label> How
I have a drop down box and some text input fields below it. Based
I have a View where some input text to be added dynamica using jquery,
I have the following input XML: <root age=1> <description>some text</description> <section> <item name=a> <uuid>1</uuid>
Let's say I have some HTML and Javascript which adds text fields dynamically to

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.