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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:45:36+00:00 2026-05-27T17:45:36+00:00

I was using this statement in my code to cache the jquery selector and

  • 0

I was using this statement in my code to cache the jquery selector and this was causing an error in the console. The error was "Missing ; before statement"

var $medium-image-holder = $('#image_'+itemID_value);

where itemID_value is a numeric value. This statement is inside a for loop

Out of curiosity and after trying various tricks to overcome this thing, I replaced the hyphen with underscore in the variable name.

var $medium_image_holder = $('#image_'+itemID_value);

Surprisingly this worked.

I want to know whether using hyphens in JavaScript variable names is not permitted. At least, I didn’t know about this. Would be very helpful if someone clarifies.

  • 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-27T17:45:37+00:00Added an answer on May 27, 2026 at 5:45 pm

    Your statement $medium-image-holder is interpreted as $medium - image - holder ($medium minus image minus holder).

    After interpreting this statement as an algebraic expression, you try to set the outcome of it to a value with another statement (=$('#image_'+itemID_value)), which is not allowed. That is where your error message comes from.

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

Sidebar

Related Questions

Using this jquery code: <a href=javascript:void(0) id=m1>Get Selected id's</a> jQuery(#m1).click( function() { var s;
I'm using this jQuery code: $.ajax ({ type: POST, url: customerfilter.php, data: dataString, cache:
I saw this C# using statement in a code example: using StringFormat=System.Drawing.StringFormat; What's that
I'm using this statement //some code int a[][]=new int[5000000][5000000]; //some code and running it
A few days ago I posted this question: switch statement and loops using jquery/javascript
This is the statement which I am referering the below code $.ajaxSetup ({ cache:
I have a problem when trying to execute this update statement (below) using C#
I'm using Python 2.5. I'm trying to use this 'with' statement. from __future__ import
I'm using prepared statements and MySQLi, and am currently getting this error. PHP Catchable
Using this: Can I use Facebook's fb:friend-selector in an iframe? I created a multi-friend

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.