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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:57:57+00:00 2026-05-22T11:57:57+00:00

I need to select all values from following input fields to their respective divs..

  • 0

I need to select all values from following input fields to their respective divs.. see bellow

<div id='table_row_div'>
  <div id='txtbox'><input type=text name='from' value='<?php echo $someVal?>'></div>
  <div id='splited'>
    <div new="0"><div>i want text's splited value here</div>
    <div new="1"><div>i want text's splited value here</div>
    <div new="2"><div>i want text's splited value here</div>
  </div>
</div>

These input text fileds contains (1,0,0), (0,1,1), (1,0,1) type values…
The above block is about 49 times… and i want an automated system that splits the text value, and push only “one” character on each next div of attr(new);

how can i do this using jquery. i tried following type of code..

var inputVal = $("#table_row_div #txtbox input");
var arrayFromDB = inputVal.val().split(',');


inputVal.closest('div').closest('div').find('div[new~="0"]').text(arrayFromDB[0]);
inputVal.closest('div').closest('div').find('div[new~="1"]').text(arrayFromDB[1]);
inputVal.closest('div').closest('div').find('div[new~="2"]').text(arrayFromDB[2]);

But this doesn’t work…

  • 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-22T11:57:58+00:00Added an answer on May 22, 2026 at 11:57 am

    First things first – don’t use an ID more than once. IDs are designed to be unique.

    Change your IDs for classes if they’re not going to be unique.

    You can implement the solution you need like this:

    HTML

    <div class='table_row_div'>
        <div>
            <input type='text' class='txtbox' name='from' value='<?php echo $someVal?>'>
        </div>
        <div class='split'>
            <div new="0">First split value</div>
            <div new="1">Second split value</div>
            <div new="2">Third split value</div>
        </div>
    </div>
    

    jQuery

    $('.txtbox').each(function() {
        var arrayFromDB = $(this).val().split(',');
        var splitDiv = $(this).closest('.table_row_div').find('.split');
        $('div[new~="0"]', splitDiv).text(arrayFromDB[0]);
        $('div[new~="1"]', splitDiv).text(arrayFromDB[1]);
        $('div[new~="2"]', splitDiv).text(arrayFromDB[2]);
    });
    

    Working demo on jsfiddle.net.

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

Sidebar

Related Questions

No related questions found

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.