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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:24:56+00:00 2026-05-30T11:24:56+00:00

I have an INPUT text field, a DIV and an IMG. The IMG has

  • 0

I have an INPUT text field, a DIV and an IMG.

The IMG has an onClick event:

  • reads the INPUT field’s current value,

  • increase it with 1,

  • does a calculation with the increased value,

  • writes the result into the DIV.

The value of the INPUT is always increased the right way and the DIV’s innerHTML always gets the right result but nothing changes in display. The displayed numbers always stay the same even if everything is done correctly in the “background”.

The funny thing in it that I used the same operation at another place on the same site and there everything works and displays perfectly.

Here is the function:

    function priceCalculator(max_amound,price,id)
    {
        var amound = parseInt(document.getElementById('sell_amound_' + id).value);
        max_amound = parseInt(max_amound);
        if (amound < max_amound)
        {
            amound = amound + 1;
            document.getElementById('sell_amound_' + id).value = amound;
            var item_value = amound * price;
            document.getElementById('price_' + id).innerHTML = item_value;

            alert(document.getElementById('sell_amound_' + id).value + ',' + document.getElementById('price_' + id).innerHTML);
        }
    }

And here are the elements within a PHP code:

<img src="images/plus.png" onclick="priceCalculator(\''.$bag_items[$i]['amound'].'\',\''.$bag_items[$i]['infos']['price'].'\',\''.$i.'\')" />
<form>
    <input id="sell_amound_'.$i.'" type="text" readonly value="1" />
</form>
<div id="price_'.$i.'">'.$bag_items[$i]['infos']['price'].'</div>

The alert at the end of the function shows the right values but the displayed values stay the same.

It’s a really simple action… What could be the problem?

EDIT:

After loading the source code of an “item” looks like this (these parts are created with loops from database, and, of course, I removed the irrelevant styling from the code and those many divs are there because of them):

<td>
    <img id="item_pic_3" src="images/potions/3.png" onClick="shopSellInfo('3')" />
    <div>26</div>
    <form>
        <input type="hidden" id="selected_item" value="" />
    </form>
    <div id="item_3" style="display: none;">
        <span>blah...</span><br />
        <span>
            <br />blah...<br /><br />
            <div>
                <div>
                    <img src="images/increase.png" onclick="priceCalculator('26','10','3')" /><br />
                </div>
            <div>
            <form>
                <input id="sell_amound_3" type="text" readonly value="1" />
            </form>
            /26
            </div>
        </div>
        <br />
        <div id="price_3">10</div>
        </span>
    </div>
</td>

shopSellInfo(‘3’) is the function that makes item_3 displayed at the right place.

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

    I solved the problem!

    The problem was that the IDs appeared at another place, too, so the function didn’t know where to change the values because of the duplicated IDs.

    Anyway, thanks your answers and will for help!

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

Sidebar

Related Questions

I have an input text field, which has a value something by default, but
I have 1 div and 1 text input field, the div is visible and
I have an input text field which has style: visibility: visible or style: visibility:
I have an input field which has a placeholder text. I want one word
I have multiple input text fields grouped in divs: <div class=container0> <input class=containerItem0 name=containerItem[0][0]
I have an input (text field) in update panel, and it autopostbacks after each
I have a jQuery jPicker colorpicker that is bound to an input text field
I have a text input field like text box or text area. I want
Newbie question... The objective: I intend to have an HTML text input field as
Dear community members, I have a small problem, which involves a text input field

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.