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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:10:02+00:00 2026-06-09T01:10:02+00:00

I let the user create images and buttons (a button with image above it)by

  • 0

I let the user create images and buttons (a button with image above it)by clicking on a button: “new_a_window” so I use append() in jQuery. But the question is that I have to get the different image as the user press on it.

As the user click the “new_a_window” button, jQuery will create a button with a image in a jDialog(story_pages).

$( '#new_a_window').bind('click',function(){
 $('#story_pages').append('<div><button value=window_value
 style="width:100px; height:100px" >

 <img id=window_value src="../pic/white.png" width="100px" height="100px"> 
 </button></div>');
 window_value= window_value+1; //I give each of the images a unique integer value since of 
                               // the value is the index of a image array. 
 })

I have to implement the scenario:

  • As the user presses on the image button, I can get the image’s id value.
    However, after appending the code snippet above, each image’s value is “window_value”,
    I can’t select it by value. How can I do?

    • 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-09T01:10:05+00:00Added an answer on June 9, 2026 at 1:10 am

      try

      $('#story_pages').append('<div><button value=window_value
       style="width:100px; height:100px" >
      
       <img value="'+window_value+'" src="../pic/white.png" width="100px" height="100px"> 
       </button></div>');
      

      Issue is that you were simple setting the value to a string ‘window_value’ not the value inside a variable.

      Hope this helps

      UPDATE

      ID should never be a number, if you wish to use id you will need to add text before it.

      '<img id="window'+window_value+'" src="'
      

      to select either one you could possibly do.

      $('#window1') for id’s or i believe $('img[value="1"]') would work with values
      (not 100% as value is not a standard attribute)

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

    Sidebar

    Related Questions

    I know how to let user select an image from UIImagePickerController, but I don't
    Is there a way to let user choose what icon theme to use ,
    How can I let the user see the front facing camera, but prevent them
    I wanted to use the UiImagePicker to record a video then let the user
    I have found a suitable way to let user bulk upload images http://www.plupload.com/index.php After
    Let’s say I have a YouTube-style site, but with images rather than videos. Each
    Let say I want to create comic reader app where the user can download
    I am using this plugin to let users upload images trough ajax. To create
    Let's say I want to use the $wpdb class to retrieve image locations from
    Is it possible to let user enters a path with quotes in JFileChooser and

    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.