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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:45:20+00:00 2026-06-11T16:45:20+00:00

I’m learning HTML/CSS/JS/jQuery, and so decided to make a calculator to see if I

  • 0

I’m learning HTML/CSS/JS/jQuery, and so decided to make a calculator to see if I could.
I’ve done most of the HTML/CSS design (well, basic enough CSS for it to be usable and the HTML may be subject to change), and moved onto the Javascript.
What I’m trying to do first of all is to make it so when you click on a number, it appends it to the end of the result text (unless its 0 and the result is 0).
If you look at the Javascript section in the jsFiddle link I’ve put at the bottom of this question, you can see what I tried.
I ran JSLint and got the following errors, but didn’t understand them:

Error:
Problem at line 4 character 9: Expected an assignment or function call and instead saw an expression.
val text = $(this).text();

Problem at line 4 character 12: Missing semicolon.
val text = $(this).text();

Implied global: $ 1,2,4,5,6, alert 3, val 4, text 4,5,6

jsFiddle link to the calculator in progress

EDIT: Also, if anyone would like to suggest a difference approach to the calculator’s HTML, please do so (I think the current method looks ugly).

EDIT 2: The val instead of var has been said. After correcting my code, the result is still not appending the number clicked. This is the question now.

EDIT 3: And as I made that edit, I found an answer has been edited to correct this.
THANKS FOR ANSWERING! 🙂

Also, here’s the working jsFiddle.

  • 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-11T16:45:21+00:00Added an answer on June 11, 2026 at 4:45 pm

    Use var instead of val .. this was messing it up..

    Instead of

    val text = $(this).text();
    

    use

    var text = $(this).text();
    

    Also you are using this $('#result').text().append(text);

    You need to append to the selector and not to the text..

    $('#result').append(text);
    

    Check this UPDATED FIDDLE

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
i got an object with contents of html markup in it, for example: string
I have thousands of HTML files to process using Groovy/Java and I need to

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.