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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:27:08+00:00 2026-06-07T02:27:08+00:00

this is my jquery code. http://jsfiddle.net/geekrule/ZnAvP/1/ as i select an image,a text-box is added

  • 0

this is my jquery code. http://jsfiddle.net/geekrule/ZnAvP/1/
as i select an image,a text-box is added with the image’s source and a ‘name’ property is added.
now when i unselect the image,i want the ‘name’ to be updated.

for ex:
i select images 1,3,4,5
corresponding value of 'name' of input boxes will be 1,2,3,4
and now when i unselect images -3,4
value of 'name' should be 1 and 2(this part is what i am stuck at.the values i get are 1,4).


they are not getting updated.
hope you understood the problem.please help me out. thanks in advance

  • 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-07T02:27:10+00:00Added an answer on June 7, 2026 at 2:27 am

    In my opinion the simpler solition is to re-generate textboxes on each image selection:

    <div id="selectList">
        <img src="http://tinyurl.com/26asnv7" />
        <img src="http://tinyurl.com/26asnv7" />
        <img src="http://tinyurl.com/26asnv7" />
        <img src="http://tinyurl.com/26asnv7" />
        <img src="http://tinyurl.com/26asnv7" />
        <img src="http://tinyurl.com/26asnv7" />
        <img src="http://tinyurl.com/26asnv7" />
        <img src="http://tinyurl.com/26asnv7" />
    </div><form id='if' name='forms' method='post'>
    <button type='submit' class="uploadPic">Upload Fb</button>
    </form>
    ​
    $(function() {
        $("#selectList img").click(
        function(event) {
            if( !$(this).is(".clicked") && $("#selectList img.clicked").length >= 3){
                event.preventDefault();
                alert('only 3 photos allowed');
                return;
            }
            $(this).toggleClass("clicked");
            regenerateTextBoxes();
        });
    });
    
    function regenerateTextBoxes() {
        $('#if .selection').remove();
        $("#selectList img.clicked").each(function(index, element) {
            var $input = $('<div>', {
                'class': 'selection',
                'html': $('<input>', {
                    'type': 'text',
                    'value': $(this).attr('src'),
                    'name': 'pics' + index
                })
            });
    
            $("#if").append($input);
        });
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found this jQuery code on a forum: http://jsfiddle.net/nZLpk/8/ However, if I change the
not sure what is wrong with this jquery code: http://jsfiddle.net/aCABM/ I want to to
Check this code: http://jsfiddle.net/ZXN4S/1/ HTML: <div class=input> <input type=text size=50 id=test_input> <input type=submit value=send
I have this code: http://jsfiddle.net/Q4PUw/2/ Hence, a simple HIDDEN TO VISIBLE jQuery Script. What
All of this is code is here: http://jsfiddle.net/yrgK8/ I have a news section which
jsFiddle Full Code: http://jsfiddle.net/bvmdW/ I used jQuery Embedly to replace YouTube links with thumbnail
This jquery code below is for a text input box to help users enter
I have this code: http://jsfiddle.net/J6vzU/1/ I want to dynamically display thumbnail of uploaded file
I have code located here http://jsfiddle.net/jostster/5XAUb/ This works in Safari / FF (for the
Here's my code ( http://jsfiddle.net/nB4Hg/ ): JQuery: // plugin code (function($) { $.fn.coloredDiv =

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.