• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

What's the jQuery to find this attribute?

What's the jQuery to find all elements where I set the following?


$("#anyElement").attr("myFlag",1")
0
newbieweb
Asked:
newbieweb
  • 3
  • 2
3 Solutions
 
danbaugherCommented:
The string you provided has a syntax error. To find objects in the dom with the attribute myFlag set to 1 try, $('*[myFlag=1]')
0
 
newbiewebAuthor Commented:
Thanks. What's the syntax error?
0
 
newbiewebAuthor Commented:
Also, what's the syntax if I wanted all elements with any value for myFlag?

PS I see the syntax error: thanks.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
danbaugherCommented:
$('[myflag]')
0
 
sonawanekiranCommented:
If you want to check the attribute then

if($("#anyElement").attr("myFlag") == "1")
 // your code
0
 
newbiewebAuthor Commented:
Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now