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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:46:02+00:00 2026-06-10T10:46:02+00:00

after having done some research, I seek you for some jquery math help. I

  • 0

after having done some research, I seek you for some jquery math help.

I would like to change a textfield, which states the price of a product, through “option rel=”

I put the html code here: http://jsfiddle.net/YjLM7/

So if the select list states:

<option selected="selected" rel="price-" value="0">50 x 50 cm</option>

The standard price is shown.

if I change the select list to:

<option rel="price-100" value="1">100 x 100 cm</option>

The price should increase by 100 (and go back -100, if first option is selected).

Would apreciate your help!

Here the full code:

<select>
<option selected="selected" rel="price-" value="0">50 x 50 cm</option>

<option rel="price-100" value="1">100 x 100 cm, Price add: €  100,00</option>
</select>

<p>Price</p>
<p><strong>200 €</strong></p>

<form method="post" action="catalog/category-1/product-1.html">
<input type="hidden" value="" name="productid">
<input type="submit" class="button" value="Add to cart" name="addcart">
</form>

​

  • 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-10T10:46:04+00:00Added an answer on June 10, 2026 at 10:46 am

    See this jsfiddle.

    <select>
       <option data-price="" selected="selected" value="0">50 x 50 cm</option>
    
       <option data-price="100" value="1">100 x 100 cm, Price add: €  100,00</option>
    </select>
    
    <p>Price</p>
    <p><strong data-price="200">200 €</strong></p>
    
    <form method="post" action="catalog/category-1/product-1.html">
          <input type="hidden" value="" name="productid">
          <input type="submit" class="button" value="Add to cart" name="addcart">
    </form>
    ​
    ​
    

    and JS:

    $("select").change(function(){
       var price = parseFloat($(this).find("option:selected").data("price"));
       if(isNaN(price))
           price = 0;
       var currPrice = parseFloat($("strong").data("price"));
       $("strong").text(currPrice + price + ' €');
    })​
    

    ​

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

Sidebar

Related Questions

I have a problem I would like some help at. I need to create
After having converted a messed up XML using regex, I now need to change
I am programming C on cygwin windows. After having done a bit of C
Originally, I was having some issues getting this code to function, but after a
What can be done to prevent having to restart a PC after a program
I've done this before but for some reason I'm really having some difficulty creating
I have limited experience of using PHP, but having done some searching around it
I was wondering after having some issues with Git what the best way to
After having some issues using OpenSSL and gSOAP, I have been looking into the
Ok so after having re-read over my previous post asking for help on this

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.