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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:23:11+00:00 2026-06-14T17:23:11+00:00

I want to create an eshop basket.. so i want to count items up

  • 0

I want to create an eshop basket.. so i want to count items up when i press a buy button. I tried to use getElementById and simple call the name of id in my basket.

—

<script type="text/javascript">
    var index = 0;
</script>

somewhere in the top —–

<div>items :<input type="text" id="tb" style="width: 20px; color:green; font-weight:bold; border:none; background: none; margin-left:20px;"/></div>

and when i press the buy button ——-

<input  name="button" type="submit" value="add to basket" onClick="index = index + 1;document.getElementById('tb').value = index;" />

so this is worked .. but know i want to duplicate the basket and have it twice in the page ( in the top and in the end ) so if i tried to call again the same id it just don’t work (cause the uniqueness of id). I suppose i should use classname istead but i don’t know how ..

I’m more than new to js hoping for a solution.
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-14T17:23:12+00:00Added an answer on June 14, 2026 at 5:23 pm

    You could duplicate document.getElementById('tb').value = index and use a second (unique) id. Or you iterate over documnet.getElementsByName('elementsname'), but your input would have to have a name attribute.

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

Sidebar

Related Questions

i want create one simple windows form ,it just contain Editcontrol(textbox),Static Edit(label),Button (Name of
I want create a UIImageView with a button press. I did this with: -
I want create some simple animation for my program. There is 4 invisible button,
I want create an application with animate button? how can i do? after click
I'm trying to learn JPA and I want create a simple Java command line
I want create a button option that takes the entire datalist and converts it
I want create cursor inside procedure body dynamically also i have to use for
I want create a process under another user. So I use LogonUser and CreateProcessAsUser.
I want create a car dashboard to use with an application written for Android
I want create simple puzzle to select random 5 names from input. Lets say

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.