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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:04:57+00:00 2026-05-30T09:04:57+00:00

I want to create a couple if statements grabbing the ID using contains (*=)

  • 0

I want to create a couple if statements grabbing the ID using contains (*=) and img that equals (=). What might I be doing wrong?

if($("div[id*='Point_'], [img='gray.png']").length > 0 ) {

// do something gray
}

if($("div[id*='Point_'], [img='red.png']").length > 0 ) {

// do something red
}
<div id="Point_1">
    <img src="gray.png">
</div>
<div id="Point_2">
    <img src="red.png">
</div>
  • 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-30T09:04:59+00:00Added an answer on May 30, 2026 at 9:04 am

    You’re attempting to use a tag selector like an attribute selector. If you want to match the <img> tag where the src attribute equals gray.png then the correct selector is $('img[src="gray.png"]').

    Also, this may or may not be correct for what you want to do, but the comma in a jQuery selector acts like an OR, so you’re saying “Give me any <div> element where the id attribute contains the text ‘Point_’ OR any <img> element where the src matches ‘gray.png’.” If that’s what you want, then ok.

    However, it seems more likely that what you want to do is select the <img> element with a src equal to gray.png that is within a <div> with an ID containing ‘Point_’, so the selector should be:

    $('div[id*="Point_"] img[src="gray.png"]')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to create an LinkedList of couple that the key is a String
I want to create an index page with a couple of results for each
I want to create a stored procedure (on SQL Server 2005) that fetches a
I want to create an app that has pictures Ive taken or created and
I want to create a form inside a PHP file that will allow me
First, I am using .net 3.5. I want to create an online chat system
I want to create my own control that will consist of several UILabels and
I want to create a website that allows me to sketch something in real
I have a generic list List<T> and I want to create a view that
I'm designing a rather long form that will auto-save every couple minutes (i.e., using

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.