Solved

What's the jQuery to find this attribute?

Posted on 2011-09-26
6
230 Views
Last Modified: 2012-05-12
What's the jQuery to find all elements where I set the following?


$("#anyElement").attr("myFlag",1")
0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Assisted Solution

by:danbaugher
danbaugher earned 333 total points
ID: 36689824
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
 

Author Comment

by:newbieweb
ID: 36691422
Thanks. What's the syntax error?
0
 

Author Comment

by:newbieweb
ID: 36692693
Also, what's the syntax if I wanted all elements with any value for myFlag?

PS I see the syntax error: thanks.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Assisted Solution

by:danbaugher
danbaugher earned 333 total points
ID: 36704136
$('[myflag]')
0
 
LVL 17

Accepted Solution

by:
sonawanekiran earned 167 total points
ID: 36706418
If you want to check the attribute then

if($("#anyElement").attr("myFlag") == "1")
 // your code
0
 

Author Closing Comment

by:newbieweb
ID: 36708971
Thanks!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Link Anchor Not working 9 67
Slush on text 2 25
Javascript: Mouseup doesn't follow mousedown 13 60
allow link tag to be submit like form 15 60
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question